Skip to content

Commit

Permalink
lib/gshadow.c: build_list(): Transform while loop into for loop
Browse files Browse the repository at this point in the history
And 'n' is now an iterator.  Rename it to 'i' as usual.

Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar authored and hallyn committed Dec 6, 2024
1 parent 512deec commit 2f74389
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/gshadow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2f74389

Please sign in to comment.