Commit 376edd78 authored by Andreas Schlick's avatar Andreas Schlick Committed by Rusty Russell

asort: Remove constness from ctx pointer.

parent abac6053
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
#if HAVE_NESTED_FUNCTIONS #if HAVE_NESTED_FUNCTIONS
void _asort(void *base, size_t nmemb, size_t size, void _asort(void *base, size_t nmemb, size_t size,
int(*compar)(const void *, const void *, const void *ctx), int(*compar)(const void *, const void *, void *ctx),
const void *ctx) void *ctx)
{ {
/* This gives bogus "warning: no previous prototype for ‘cmp’" /* This gives bogus "warning: no previous prototype for ‘cmp’"
* with gcc 4 with -Wmissing-prototypes. Hence the auto crap. */ * with gcc 4 with -Wmissing-prototypes. Hence the auto crap. */
...@@ -107,8 +107,8 @@ typedef struct ...@@ -107,8 +107,8 @@ typedef struct
void void
_asort (void *const pbase, size_t total_elems, size_t size, _asort (void *const pbase, size_t total_elems, size_t size,
int(*cmp)(const void *, const void *, const void *arg), int(*cmp)(const void *, const void *, void *arg),
const void *arg) void *arg)
{ {
register char *base_ptr = (char *) pbase; register char *base_ptr = (char *) pbase;
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
*/ */
#define asort(base, num, cmp, ctx) \ #define asort(base, num, cmp, ctx) \
_asort((base), (num), sizeof(*(base)), \ _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), \ (cmp), &*(cmp), \
int (*)(const __typeof__(*(base)) *, \ int (*)(const __typeof__(*(base)) *, \
const __typeof__(*(base)) *, \ const __typeof__(*(base)) *, \
__typeof__(ctx))), (ctx)) __typeof__(ctx))), (ctx))
void _asort(void *base, size_t nmemb, size_t size, void _asort(void *base, size_t nmemb, size_t size,
int(*compar)(const void *, const void *, const void *), int(*compar)(const void *, const void *, void *),
const void *ctx); void *ctx);
#endif /* CCAN_ASORT_H */ #endif /* CCAN_ASORT_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment