From fce1d884795f311c1024915fc4a9161e141fcebd Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 15 Jan 2024 19:07:28 +0100 Subject: [PATCH] lib/list.c: is_on_list(): Call strsep(3) instead of open-coding it Signed-off-by: Alejandro Colomar --- lib/list.c | 8 ++------ 1 file 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; /*