diff options
author | Alejandro Colomar <alx@kernel.org> | 2024-01-17 02:46:21 +0100 |
---|---|---|
committer | Serge Hallyn <serge@hallyn.com> | 2024-03-14 17:11:36 -0500 |
commit | fb01e07e83763733a2ad825ef6fc6974b25401f9 (patch) | |
tree | dac8ef875b1d18ebcffe36a85c0c3638a8ed46b3 | |
parent | 08ae38e394c3de580591092894d7aba03c839b8e (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.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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 |