]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/gshadow.c: build_list(): Improve variable and parameter names
authorAlejandro Colomar <alx@kernel.org>
Mon, 4 Nov 2024 16:48:39 +0000 (17:48 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 6 Dec 2024 03:20:59 +0000 (21:20 -0600)
It was hard to understand what each variable is.  Use a consistent
scheme, where a 'p' means a pointer, 'l' means list, and 'n' means
number of elements.  Those should be obvious from the name of the
function and the context, and will make it easier to read the code.
Also, the shorter names will allow focusing on the rest of the code.

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

index 4f2d5925fb5ed38f1b371f7e54cbac1a1d13cf6a..7375049ddf85f7acb6cb3d3eae50075f71cfbed0 100644 (file)
@@ -37,24 +37,24 @@ static struct sgrp sgroup;
 
 
 static /*@null@*/char **
-build_list(char *s, char ***list, size_t *nlist)
+build_list(char *s, char ***lp, size_t *np)
 {
-       char **ptr = *list;
-       size_t nelem = *nlist;
+       char    **l = *lp;
+       size_t  n = *np;
 
        while (s != NULL && *s != '\0') {
-               ptr = XREALLOC(*list, nelem + 1, char *);
-               ptr[nelem] = strsep(&s, ",");
-               nelem++;
-               *list = ptr;
-               *nlist = nelem;
+               l = XREALLOC(*lp, n + 1, char *);
+               l[n] = strsep(&s, ",");
+               n++;
+               *lp = l;
+               *np = n;
        }
 
-       ptr = XREALLOC(*list, nelem + 1, char *);
-       ptr[nelem] = NULL;
-       *list = ptr;
+       l = XREALLOC(*lp, n + 1, char *);
+       l[n] = NULL;
+       *lp = l;
 
-       return ptr;
+       return l;
 }
 
 void setsgent (void)