From f5d258504333d5598428853b7293e26814f65acf Mon Sep 17 00:00:00 2001 From: Michael Grunder Date: Mon, 25 May 2020 12:17:43 -0700 Subject: Use unique names for allocator struct members (#823) Using `strdup` as a struct member causes issues in older gcc --- alloc.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'alloc.c') diff --git a/alloc.c b/alloc.c index 2b19c48..7fb6b35 100644 --- a/alloc.c +++ b/alloc.c @@ -34,11 +34,11 @@ #include hiredisAllocFuncs hiredisAllocFns = { - .malloc = malloc, - .calloc = calloc, - .realloc = realloc, - .strdup = strdup, - .free = free, + .mallocFn = malloc, + .callocFn = calloc, + .reallocFn = realloc, + .strdupFn = strdup, + .freeFn = free, }; /* Override hiredis' allocators with ones supplied by the user */ @@ -53,34 +53,34 @@ hiredisAllocFuncs hiredisSetAllocators(hiredisAllocFuncs *override) { /* Reset allocators to use libc defaults */ void hiredisResetAllocators(void) { hiredisAllocFns = (hiredisAllocFuncs) { - .malloc = malloc, - .calloc = calloc, - .realloc = realloc, - .strdup = strdup, - .free = free, + .mallocFn = malloc, + .callocFn = calloc, + .reallocFn = realloc, + .strdupFn = strdup, + .freeFn = free, }; } #ifdef _WIN32 void *hi_malloc(size_t size) { - return hiredisAllocFns.malloc(size); + return hiredisAllocFns.mallocFn(size); } void *hi_calloc(size_t nmemb, size_t size) { - return hiredisAllocFns.calloc(nmemb, size); + return hiredisAllocFns.callocFn(nmemb, size); } void *hi_realloc(void *ptr, size_t size) { - return hiredisAllocFns.realloc(ptr, size); + return hiredisAllocFns.reallocFn(ptr, size); } char *hi_strdup(const char *str) { - return hiredisAllocFns.strdup(str); + return hiredisAllocFns.strdupFn(str); } void hi_free(void *ptr) { - hiredisAllocFns.free(ptr); + hiredisAllocFns.freeFn(ptr); } #endif -- cgit v1.2.3