X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fasort%2Fasort.c;h=e7eaf2c2999b68a3f0f6ea9d3b300f59df38ffc7;hp=9f5868619095b354c28da27d3e6efd18557790ba;hb=5887216aa53cdb4709e9658462c4d4b2141ef91a;hpb=376edd78d31c1c542e19ae896006cd17ccb459f0 diff --git a/ccan/asort/asort.c b/ccan/asort/asort.c index 9f586861..e7eaf2c2 100644 --- a/ccan/asort/asort.c +++ b/ccan/asort/asort.c @@ -1,21 +1,8 @@ #include #include -#if HAVE_NESTED_FUNCTIONS -void _asort(void *base, size_t nmemb, size_t size, - int(*compar)(const void *, const void *, void *ctx), - void *ctx) -{ - /* This gives bogus "warning: no previous prototype for ‘cmp’" - * with gcc 4 with -Wmissing-prototypes. Hence the auto crap. */ - auto int cmp(const void *a, const void *b); - int cmp(const void *a, const void *b) - { - return compar(a, b, ctx); - } - qsort(base, nmemb, size, cmp); -} -#else +#if !HAVE_QSORT_R_PRIVATE_LAST + /* Steal glibc's code. */ /* Copyright (C) 1991,1992,1996,1997,1999,2004 Free Software Foundation, Inc. @@ -268,4 +255,5 @@ _asort (void *const pbase, size_t total_elems, size_t size, } } } -#endif /* !HAVE_NESTED_FUNCTIONS */ + +#endif /* !HAVE_QSORT_R_PRIVATE_LAST */