+/* 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)), \