From fb01e07e83763733a2ad825ef6fc6974b25401f9 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 17 Jan 2024 02:46:21 +0100 Subject: [PATCH] lib/list.c: is_on_list(): Move code out of loop Signed-off-by: Alejandro Colomar --- lib/list.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/list.c b/lib/list.c index d25130321..b88f5c5ab 100644 --- a/lib/list.c +++ b/lib/list.c @@ -235,13 +235,12 @@ bool is_on_list (char *const *list, const char *member) for (cp = members, i = 0;; i++) { array[i] = cp; cp = strchr(cp, ','); - if (NULL != cp) { + if (NULL != cp) *cp++ = '\0'; - } else { - array[i + 1] = NULL; + else break; - } } + array[i+1] = NULL; /* * Return the new array of pointers -- 2.47.2