nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 63d64d7cf894b83b43ce7c9ef9aa0b4cc0129723
parent 23acf56fffa0b317acdf5fad76387a9bda838f1c
Author: Rolf Eike Beer <eike@sf-mail.de>
Date:   Sat, 13 Jun 2020 14:55:02 +0200

alloc.h: make first argument of alloc_re() void**

There are different types passed in to alloc_re(), which never raised an error
before as there were no arguments in the header files. Make it void** so it's
clear that this is just anonymous memory.

Diffstat:
Malloc.h | 4++--
Menv.c | 2+-
Mgen_allocdefs.h | 2+-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/alloc.h b/alloc.h @@ -5,9 +5,9 @@ #define alloc(x) malloc(x) #define alloc_free(x) free(x) -static inline int alloc_re(char **x, unsigned int m, unsigned int n) +static inline int alloc_re(void **x, unsigned int m, unsigned int n) { - char *y = realloc(*x, n); + void *y = realloc(*x, n); (void)m; if (y != NULL) *x = y; diff --git a/env.c b/env.c @@ -55,7 +55,7 @@ static int env_add(s) char *s; if (en == ea) { ea += 30; - if (!alloc_re(&environ,(en + 1) * sizeof(char *),(ea + 1) * sizeof(char *))) + if (!alloc_re((void**)&environ,(en + 1) * sizeof(char *),(ea + 1) * sizeof(char *))) { ea = en; return 0; } } environ[en++] = s; diff --git a/gen_allocdefs.h b/gen_allocdefs.h @@ -20,7 +20,7 @@ static int ta_rplus ## _internal (ta *x, unsigned int n, unsigned int pluslen) \ return 0; \ if (__builtin_mul_overflow(nnum, sizeof(type), &nlen)) \ return 0; \ - if (!alloc_re(&x->field,x->a * sizeof(type),nlen)) \ + if (!alloc_re((void**)&x->field,x->a * sizeof(type),nlen)) \ return 0; \ x->a = nnum; \ return 1; } \