add bsearch for arrays

Arrays can already be sorted with json_object_array_sort() which uses
qsort() of the standard C library. This adds a counterpart using the
bsearch() from C.
This commit is contained in:
Alexander Dahl
2014-08-21 15:42:50 +02:00
parent d4e81f9ec8
commit 2f5789bdef
4 changed files with 49 additions and 2 deletions

View File

@@ -49,6 +49,11 @@ array_list_length(struct array_list *al);
extern void
array_list_sort(struct array_list *arr, int(*compar)(const void *, const void *));
extern void* array_list_bsearch( const void **key,
struct array_list *arr,
int (*sort_fn)(const void *, const void *) );
#ifdef __cplusplus
}
#endif