merge from open-source master

Change-Id: I950e9aca87cbb0c35099b1d53cff6378bd0f26f4
This commit is contained in:
The Android Open Source Project 2010-03-31 14:24:25 -07:00
commit 1d168621a5

View File

@ -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);