Skip to content

Commit

Permalink
lib/list.c: is_on_list(): Call strsep(3) instead of open-coding it
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar authored and hallyn committed Mar 14, 2024
1 parent 46fd68c commit fce1d88
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/list.c
Expand Up @@ -232,12 +232,8 @@ bool is_on_list (char *const *list, const char *member)
* array of pointers.
*/

for (cp = members, i = 0; cp != NULL; i++) {
array[i] = cp;
cp = strchr(cp, ',');
if (NULL != cp)
*cp++ = '\0';
}
for (cp = members, i = 0; cp != NULL; i++)
array[i] = strsep(&cp, ",");
array[i] = NULL;

/*
Expand Down

0 comments on commit fce1d88

Please sign in to comment.