X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fasearch%2Fasearch.h;h=aae6eeda959acd9a18695f7f9707fa83c3170392;hp=2c28ab1c1d89d5f6956f7a0e417f1ca1e15be364;hb=56023cca5f66a40646a1e807c3d10af6e5913623;hpb=93d1e1063c6b5599ab334398234d2de05c1236e8 diff --git a/ccan/asearch/asearch.h b/ccan/asearch/asearch.h index 2c28ab1c..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((cmp), \ - int (*)(const __typeof__(*(key)) *, \ - const __typeof__(*(base)) *), \ - int (*)(const void *, const void *))))) + 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)), \