From: Alejandro Colomar Date: Sat, 15 Nov 2025 20:56:34 +0000 (+0100) Subject: lib/: Rename REALLOC() => realloc_T() X-Git-Tag: 4.19.0-rc1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e010eb2d4e3c7ad550e570c5bfb2fcf59f0a4440;p=thirdparty%2Fshadow.git lib/: Rename REALLOC() => realloc_T() The 'T' in the name notes that this API is a type-safe variant of the API it wraps. This makes the names more explicative. Signed-off-by: Alejandro Colomar --- diff --git a/lib/alloc/realloc.h b/lib/alloc/realloc.h index 4ba928e4a..af582e9cd 100644 --- a/lib/alloc/realloc.h +++ b/lib/alloc/realloc.h @@ -14,8 +14,9 @@ #include "sizeof.h" -#define REALLOC(p, n, T) REALLOC_(p, n, typeas(T)) -#define REALLOC_(p, n, T) \ +// realloc_T - realloc type-safe +#define realloc_T(p, n, T) realloc_T_(p, n, typeas(T)) +#define realloc_T_(p, n, T) \ ({ \ _Generic(p, T *: (void)0); \ (T *){reallocarray_(p, n, sizeof(T))}; \ @@ -24,7 +25,7 @@ #define reallocarray_(p, n, size) reallocarray(p, (n) ?: 1, (size) ?: 1) -#define XREALLOC(p, n, T) exit_if_null(REALLOC(p, n, T)) +#define XREALLOC(p, n, T) exit_if_null(realloc_T(p, n, T)) #endif // include guard diff --git a/lib/subordinateio.c b/lib/subordinateio.c index 54eb76413..978e4c6ce 100644 --- a/lib/subordinateio.c +++ b/lib/subordinateio.c @@ -276,7 +276,7 @@ static bool have_range(struct commonio_db *db, static struct subid_range * append_range(struct subid_range *ranges, const struct subordinate_range *new, int n) { - ranges = REALLOCF(ranges, n + 1, struct subid_range); + ranges = reallocf_T(ranges, n + 1, struct subid_range); if (ranges == NULL) return NULL;