]> git.ozlabs.org Git - ccan/blobdiff - ccan/asearch/asearch.h
endian: add constant versions.
[ccan] / ccan / asearch / asearch.h
index 84625d986d6adef3848dbcdcc71dfa3bfe826afb..aae6eeda959acd9a18695f7f9707fa83c3170392 100644 (file)
@@ -1,3 +1,4 @@
+/* Licensed under LGPLv2.1+ - see LICENSE file for details */
 #ifndef CCAN_ASEARCH_H
 #define CCAN_ASEARCH_H
 #include <stdlib.h>
 #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), &*(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)),         \