lib/gshadow.c: build_list(): Minimize use of pointer parameters
Use instead automatic variables as much as possible. This reduces the number of dereferences, enhancing readability. Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
30bcd185c3
commit
3feff7ae5b
+4
-4
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user