lib/gshadow.c: build_list(): Improve variable and parameter names

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>
This commit is contained in:
Alejandro Colomar
2024-11-04 17:48:39 +01:00
committed by Serge Hallyn
parent 93887b4de6
commit f3464103fb

View 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)