mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-06 15:10:22 -05:00
ITS#5578 fix binary search
This commit is contained in:
parent
99d004189a
commit
9b25fa4c38
1 changed files with 5 additions and 6 deletions
|
|
@ -324,17 +324,16 @@ attr_valfind(
|
|||
while ( 0 < n ) {
|
||||
unsigned pivot = n >> 1;
|
||||
i = base + pivot;
|
||||
if ( i >= a->a_numvals ) {
|
||||
i = a->a_numvals - 1;
|
||||
break;
|
||||
}
|
||||
rc = value_match( &match, a->a_desc, mr, flags,
|
||||
&a->a_nvals[i], cval, &text );
|
||||
if ( rc == LDAP_SUCCESS && match == 0 )
|
||||
break;
|
||||
n = pivot;
|
||||
if ( match < 0 )
|
||||
if ( match < 0 ) {
|
||||
base = i+1;
|
||||
n -= pivot+1;
|
||||
} else {
|
||||
n = pivot;
|
||||
}
|
||||
}
|
||||
if ( match < 0 )
|
||||
i++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue