]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/list.c: is_on_list(): Call strsep(3) instead of open-coding it
authorAlejandro Colomar <alx@kernel.org>
Mon, 15 Jan 2024 18:07:28 +0000 (19:07 +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 28f530685cd62cf5d5b9d2174a6c348bf5d43ff5..9fc660895e93f656d7cf117b8c462db427eb4527 100644 (file)
@@ -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;
 
        /*