projects
/
platform
/
kernel
/
linux-starfive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ASoC: topology: Change allocations to resource managed
[platform/kernel/linux-starfive.git]
/
lib
/
bsearch.c
diff --git
a/lib/bsearch.c
b/lib/bsearch.c
index
8b3aae5
..
bf86aa6
100644
(file)
--- 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().
*/
* 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);
}
EXPORT_SYMBOL(bsearch);
NOKPROBE_SYMBOL(bsearch);