lib/gshadow.c: build_list(): Transform while loop into for loop
And 'n' is now an iterator. Rename it to 'i' as usual. Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
512deecca5
commit
2f74389334
+4
-5
@@ -38,15 +38,14 @@ static /*@null@*/char **
|
||||
build_list(char *s)
|
||||
{
|
||||
char **l;
|
||||
size_t n;
|
||||
size_t i;
|
||||
|
||||
l = XMALLOC(strchrcnt(s, ',') + 2, char *);
|
||||
n = 0;
|
||||
|
||||
while (s != NULL && *s != '\0')
|
||||
l[n++] = strsep(&s, ",");
|
||||
for (i = 0; s != NULL && *s != '\0'; i++)
|
||||
l[i] = strsep(&s, ",");
|
||||
|
||||
l[n] = NULL;
|
||||
l[i] = NULL;
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user