]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/: Rename REALLOC() => realloc_T()
authorAlejandro Colomar <alx@kernel.org>
Sat, 15 Nov 2025 20:56:34 +0000 (21:56 +0100)
committerSerge Hallyn <serge@hallyn.com>
Sat, 6 Dec 2025 03:22:45 +0000 (21:22 -0600)
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 <alx@kernel.org>
lib/alloc/realloc.h
lib/subordinateio.c

index 4ba928e4a1de3dd84057b21f4dd80e491d3c9f2f..af582e9cd99c4d6d84f6f7e7dff3065779377bcc 100644 (file)
@@ -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
index 54eb7641393b3424f9d0ba95659e28c459b3eb68..978e4c6ce05378bdcb451a5990c0780d08c5f7a2 100644 (file)
@@ -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;