]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/gshadow.c: build_list(): Minimize use of pointer parameters
authorAlejandro Colomar <alx@kernel.org>
Mon, 4 Nov 2024 20:57:06 +0000 (21:57 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 6 Dec 2024 03:20:59 +0000 (21:20 -0600)
Use instead automatic variables as much as possible.
This reduces the number of dereferences, enhancing readability.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/gshadow.c

index 87546621b6a88ed719a568142f04dfbf22a84214..af0272261bf01ef55164c09c74ad3f55e3500411 100644 (file)
@@ -40,18 +40,18 @@ build_list(char *s, char ***lp)
        char    **l;
        size_t  n;
 
-       *lp = NULL;
+       l = NULL;
        n = 0;
 
        while (s != NULL && *s != '\0') {
-               l = XREALLOC(*lp, n + 1, char *);
+               l = XREALLOC(l, n + 1, char *);
                l[n] = strsep(&s, ",");
                n++;
-               *lp = l;
        }
 
-       l = XREALLOC(*lp, n + 1, char *);
+       l = XREALLOC(l, n + 1, char *);
        l[n] = NULL;
+
        *lp = l;
 
        return l;