summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-01-17 02:46:21 +0100
committerSerge Hallyn <serge@hallyn.com>2024-03-14 17:11:36 -0500
commitfb01e07e83763733a2ad825ef6fc6974b25401f9 (patch)
treedac8ef875b1d18ebcffe36a85c0c3638a8ed46b3
parent08ae38e394c3de580591092894d7aba03c839b8e (diff)
lib/list.c: is_on_list(): Move code out of loop
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--lib/list.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/list.c b/lib/list.c
index d2513032..b88f5c5a 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