]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/: Rename XREALLOC() => xrealloc_T()
authorAlejandro Colomar <alx@kernel.org>
Sat, 15 Nov 2025 20:58:10 +0000 (21:58 +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/env.c
lib/xgetXXbyYY.c
src/newgrp.c

index af582e9cd99c4d6d84f6f7e7dff3065779377bcc..ac9f046ec6d5d5b3c3d587594ac5d6804326e687 100644 (file)
@@ -25,7 +25,8 @@
 #define reallocarray_(p, n, size)  reallocarray(p, (n) ?: 1, (size) ?: 1)
 
 
-#define XREALLOC(p, n, T)  exit_if_null(realloc_T(p, n, T))
+// xrealloc_T - exit-on-error realloc type-safe
+#define xrealloc_T(p, n, T)  exit_if_null(realloc_T(p, n, T))
 
 
 #endif  // include guard
index 95b4ed5c51bc0a19be395706a48c3e55269c98f2..97339c64852bd2f4cd71c8662657336d16a68671 100644 (file)
--- a/lib/env.c
+++ b/lib/env.c
@@ -135,7 +135,7 @@ void addenv (const char *string, /*@null@*/const char *value)
 
                update_environ = (environ == newenvp);
 
-               newenvp = XREALLOC(newenvp, newenvc + NEWENVP_STEP, char *);
+               newenvp = xrealloc_T(newenvp, newenvc + NEWENVP_STEP, char *);
 
                /*
                 * If this is our current environment, update
index 1a4ca94bbc7a0d5c25cdbbecc38a42d44d276006..8b7fc543aefd97e1e20215233427fe858e3c7443 100644 (file)
@@ -61,7 +61,7 @@
        while (true) {
                int status;
                LOOKUP_TYPE *resbuf = NULL;
-               buffer = XREALLOC(buffer, length, char);
+               buffer = xrealloc_T(buffer, length, char);
                status = REENTRANT_NAME(ARG_NAME, result, buffer,
                                        length, &resbuf);
                if ((0 == status) && (resbuf == result)) {
index 3bf7291a1246d9269c1f3cf793cb9575000a62ad..77e57be509e239881f52e8d1ff59f413f98b326d 100644 (file)
@@ -671,7 +671,7 @@ int main (int argc, char **argv)
         * If the group doesn't fit, I'll complain loudly and skip this
         * part.
         */
-       gids = XREALLOC(gids, ngroups + 1, gid_t);
+       gids = xrealloc_T(gids, ngroups + 1, gid_t);
 
        LSEARCH(gid_t, &gid, gids, &ngroups);