Skip to content

Commit

Permalink
lib/bsearch: Use generic type for comparator function
Browse files Browse the repository at this point in the history
Comparator function type, cmp_func_t, is defined in the types.h,
use it in bsearch() and, thus, add more sense to the corresponding
comment in the code.

Link: http://lkml.kernel.org/r/20191007135656.37734-2-andriy.shevchenko@linux.intel.com

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
  • Loading branch information
Andy Shevchenko authored and Steven Rostedt (VMware) committed Nov 14, 2019
1 parent 52ae533 commit e8877ec
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/linux/bsearch.h
Original file line number Diff line number Diff line change
@@ -5,6 +5,6 @@
#include <linux/types.h>

void *bsearch(const void *key, const void *base, size_t num, size_t size,
int (*cmp)(const void *key, const void *elt));
cmp_func_t cmp);

#endif /* _LINUX_BSEARCH_H */
2 changes: 1 addition & 1 deletion lib/bsearch.c
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
* the same comparison function for both sort() and bsearch().
*/
void *bsearch(const void *key, const void *base, size_t num, size_t size,
int (*cmp)(const void *key, const void *elt))
cmp_func_t cmp)
{
const char *pivot;
int result;

0 comments on commit e8877ec

Please sign in to comment.