X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fbsearch.c;h=bf86aa66f2b275798ae850e321a1a459d1a6bfab;hb=ff922622443767b27232eb01bae1d9a8d42df073;hp=8b3aae5ae77a20ea4a087e0926f9eeebcdbd33d0;hpb=a032ff0e8065668e672eb2e223e265b7808f35a3;p=platform%2Fkernel%2Flinux-starfive.git diff --git a/lib/bsearch.c b/lib/bsearch.c index 8b3aae5..bf86aa6 100644 --- a/lib/bsearch.c +++ b/lib/bsearch.c @@ -28,27 +28,9 @@ * the key and elements in the array are of the same type, you can use * the same comparison function for both sort() and bsearch(). */ -void *bsearch(const void *key, const void *base, size_t num, size_t size, - cmp_func_t cmp) +void *bsearch(const void *key, const void *base, size_t num, size_t size, cmp_func_t cmp) { - const char *pivot; - int result; - - while (num > 0) { - pivot = base + (num >> 1) * size; - result = cmp(key, pivot); - - if (result == 0) - return (void *)pivot; - - if (result > 0) { - base = pivot + size; - num--; - } - num >>= 1; - } - - return NULL; + return __inline_bsearch(key, base, num, size, cmp); } EXPORT_SYMBOL(bsearch); NOKPROBE_SYMBOL(bsearch);