]> git.ozlabs.org Git - ccan/commitdiff
asort: Remove constness from ctx pointer.
authorAndreas Schlick <schlick@lavabit.com>
Fri, 4 Mar 2011 16:08:06 +0000 (17:08 +0100)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 7 Mar 2011 23:41:17 +0000 (10:11 +1030)
ccan/asort/asort.c
ccan/asort/asort.h

index ce12fe660eb9146299fcf0c53937d381bdac055f..9f5868619095b354c28da27d3e6efd18557790ba 100644 (file)
@@ -3,8 +3,8 @@
 
 #if HAVE_NESTED_FUNCTIONS
 void _asort(void *base, size_t nmemb, size_t size,
 
 #if HAVE_NESTED_FUNCTIONS
 void _asort(void *base, size_t nmemb, size_t size,
-           int(*compar)(const void *, const void *, const void *ctx),
-           const void *ctx)
+           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. */
 {
        /* This gives bogus "warning: no previous prototype for ‘cmp’"
         * with gcc 4 with -Wmissing-prototypes.  Hence the auto crap. */
@@ -107,8 +107,8 @@ typedef struct
 
 void
 _asort (void *const pbase, size_t total_elems, size_t size,
 
 void
 _asort (void *const pbase, size_t total_elems, size_t size,
-       int(*cmp)(const void *, const void *, const void *arg),
-       const void *arg)
+       int(*cmp)(const void *, const void *, void *arg),
+       void *arg)
 {
   register char *base_ptr = (char *) pbase;
 
 {
   register char *base_ptr = (char *) pbase;
 
index 731f9bde4cc1e868bec846c19dff1b7502fc204b..eaaa5b19f418a96a46a951570ad0a9bbf00ed3b0 100644 (file)
  */
 #define asort(base, num, cmp, ctx)                                     \
 _asort((base), (num), sizeof(*(base)),                                 \
  */
 #define asort(base, num, cmp, ctx)                                     \
 _asort((base), (num), sizeof(*(base)),                                 \
-       cast_if_type(int (*)(const void *, const void *, const void *), \
+       cast_if_type(int (*)(const void *, const void *, void *),       \
                    (cmp), &*(cmp),                                     \
                    int (*)(const __typeof__(*(base)) *,                \
                            const __typeof__(*(base)) *,                \
                            __typeof__(ctx))), (ctx))
 
 void _asort(void *base, size_t nmemb, size_t size,
                    (cmp), &*(cmp),                                     \
                    int (*)(const __typeof__(*(base)) *,                \
                            const __typeof__(*(base)) *,                \
                            __typeof__(ctx))), (ctx))
 
 void _asort(void *base, size_t nmemb, size_t size,
-           int(*compar)(const void *, const void *, const void *),
-           const void *ctx);
+           int(*compar)(const void *, const void *, void *),
+           void *ctx);
 
 #endif /* CCAN_ASORT_H */
 
 #endif /* CCAN_ASORT_H */