merge from open-source master
Change-Id: I950e9aca87cbb0c35099b1d53cff6378bd0f26f4
This commit is contained in:
commit
1d168621a5
@ -56,11 +56,11 @@ bsearch(const void *key, const void *base0, size_t nmemb, size_t size,
|
||||
for (lim = nmemb; lim != 0; lim >>= 1) {
|
||||
p = base + (lim >> 1) * size;
|
||||
cmp = (*compar)(key, p);
|
||||
if (cmp == 0)
|
||||
return ((void *)p);
|
||||
if (cmp > 0) { /* key > p: move right */
|
||||
base = (char *)p + size;
|
||||
lim--;
|
||||
} else if (cmp == 0) {
|
||||
return ((void *)p);
|
||||
} /* else move left */
|
||||
}
|
||||
return (NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user