X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fasearch%2Fasearch.h;h=aae6eeda959acd9a18695f7f9707fa83c3170392;hb=137c60bf9e4aa3160fbd44b99e54bcb0df5d6cbf;hp=8e317b47cf4d110a88d57815e7cce83bc18fb5fe;hpb=b1c867121f379d76dc7fb7d99bae77e2b7d99841;p=ccan diff --git a/ccan/asearch/asearch.h b/ccan/asearch/asearch.h index 8e317b47..aae6eeda 100644 --- a/ccan/asearch/asearch.h +++ b/ccan/asearch/asearch.h @@ -1,9 +1,10 @@ +/* Licensed under LGPLv2.1+ - see LICENSE file for details */ #ifndef CCAN_ASEARCH_H #define CCAN_ASEARCH_H #include #include -/* +/** * asearch - search an array of elements * @key: pointer to item being searched for * @base: pointer to data to sort @@ -23,10 +24,11 @@ #if HAVE_TYPEOF #define asearch(key, base, num, cmp) \ ((__typeof__(*(base))*)(bsearch((key), (base), (num), sizeof(*(base)), \ - cast_if_type(int (*)(const void *, const void *), \ - (cmp), \ - int (*)(const __typeof__(*(key)) *, \ - const __typeof__(*(base)) *))))) + typesafe_cb_cast(int (*)(const void *, const void *), \ + int (*)(const __typeof__(*(key)) *, \ + const __typeof__(*(base)) *), \ + (cmp))))) + #else #define asearch(key, base, num, cmp) \ (bsearch((key), (base), (num), sizeof(*(base)), \