summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-01-15 19:07:28 +0100
committerSerge Hallyn <serge@hallyn.com>2024-03-14 17:11:36 -0500
commitfce1d884795f311c1024915fc4a9161e141fcebd (patch)
tree5301b84059199bc506d7dffb79f1667a09f10bd2
parent46fd68c37e63e7c00b922c86c8e83aea4142510a (diff)
lib/list.c: is_on_list(): Call strsep(3) instead of open-coding it
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--lib/list.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/list.c b/lib/list.c
index 28f53068..9fc66089 100644
--- a/lib/list.c
+++ b/lib/list.c
@@ -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;
/*