]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/list.c: is_on_list(): Move code out of loop
authorAlejandro Colomar <alx@kernel.org>
Wed, 17 Jan 2024 01:46:21 +0000 (02:46 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 14 Mar 2024 22:11:36 +0000 (17:11 -0500)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/list.c

index d2513032162fa355f50436c3a760b6a15b991145..b88f5c5ab07937baccb7ddfe17473ed4e06c4121 100644 (file)
@@ -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