On 05/16/2013 12:39 PM, MORITA Kazutaka wrote:
> +#define typesafe_qsort(base, nmemb, compar)                          \
> +({                                                                   \
> +     assert(compar(base, base) == 0);                                \
> +     qsort(base, nmemb, sizeof(*(base)), (comparison_fn_t)compar);   \
> +})
> +
> +#define typesafe_bsearch(key, base, nmemb, compar)                   \
> +({                                                                   \
> +     (void) (key == base);                                           \
> +     assert(compar(base, base) == 0);                                \
> +     bsearch(key, base, nmemb, sizeof(*(base)), (comparison_fn_t)compar); \
> +})

I think xqsort and xbsearch is much more keyboard friendly and uniform
with other xhelpers.

Thanks,
Yuan
-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to