]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
*/: s/STRSEP2ARR/strsep2arr_a/
authorAlejandro Colomar <alx@kernel.org>
Tue, 14 Oct 2025 11:16:31 +0000 (13:16 +0200)
committerSerge Hallyn <serge@hallyn.com>
Fri, 28 Nov 2025 02:50:48 +0000 (20:50 -0600)
This name better reflects that it handles arrays, and doesn't shout.

This case is slightly different, as this macro does a little bit more
than just enforcing arrays.  It changes the return value too.  However,
that is related-enough to the handling of arrays that I'm inclined to
accept it as a minor inconsistency.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/port.c
lib/shadow/group/sgetgrent.c
lib/shadow/gshadow/sgetsgent.c
lib/shadow/passwd/sgetpwent.c
lib/string/README
lib/string/strtok/strsep2arr.h
lib/subordinateio.c
src/newusers.c

index d5338a8ad257b8b11994fa4ddcdf891f2ac8e4c0..357be218cc6b67fe7b11213e4252f317a6749946 100644 (file)
@@ -148,7 +148,7 @@ next:
 
        stpsep(buf, "\n");
 
-       if (STRSEP2ARR(buf, ":", fields) == -1)
+       if (strsep2arr_a(buf, ":", fields) == -1)
                goto next;
 
        /*
index 744a8f5cbc8b153955e6393df378a8b29e63aaa7..2a13091ef015557f4266d5b3b6fb2f3dc0d5a7ef 100644 (file)
@@ -71,7 +71,7 @@ sgetgrent(const char *s)
 
        stpsep(dup, "\n");
 
-       if (STRSEP2ARR(dup, ":", fields) == -1)
+       if (strsep2arr_a(dup, ":", fields) == -1)
                return NULL;
 
        if (streq(fields[2], ""))
index 38dce1c0ca50a1e1a4804acca64c1afc20c68e55..a239b45ad952026c2390c384cba615e4a15237d0 100644 (file)
@@ -43,7 +43,7 @@ sgetsgent(const char *s)
 
        stpsep(dup, "\n");
 
-       if (STRSEP2ARR(dup, ":", fields) == -1)
+       if (strsep2arr_a(dup, ":", fields) == -1)
                return NULL;
 
        sgroup.sg_namp = fields[0];
index ddea1384b0282e35a151fad49a49d2687808494f..1d4a060708a49d91a4e6b4edc56cd5e3355e4621 100644 (file)
@@ -53,7 +53,7 @@ sgetpwent(const char *s)
 
        stpsep(dup, "\n");
 
-       if (STRSEP2ARR(dup, ":", fields) == -1)
+       if (strsep2arr_a(dup, ":", fields) == -1)
                return NULL;
 
        /*
index 431a81d4de1e0f472f50d5384c9663a2b9cc57b7..192b7eb3abdc7345b577e0eba962eb4136e46da6 100644 (file)
@@ -264,7 +264,7 @@ strsep/ - String separation
        Loop around strsep(3) to fill an array of buffers with all
        the delimited strings that have been split.
        Useful when the number of delimiter-separated fields is known.
-    STRSEP2ARR()
+    strsep2arr_a()
        Like strsep2arr(), but take an array, and simplify error checks.
 
     strsep2ls()
index 6c98502f9ee6467d8bed0508cb870c1966f85a30..f96ddfdd742382cc370c00092ca4df04eb5402f4 100644 (file)
@@ -17,7 +17,8 @@
 #include "sizeof.h"
 
 
-#define STRSEP2ARR(s, delim, a)                                       \
+// strsep2arr_a - string separate to array-of-strings array
+#define strsep2arr_a(s, delim, a)                                     \
 (                                                                     \
        strsep2arr(s, delim, countof(a), a) == countof(a) ? 0 : -1    \
 )
@@ -29,9 +30,7 @@ inline ssize_t strsep2arr(char *s, const char *restrict delim,
     size_t n, char *a[restrict n]);
 
 
-// string separate to array-of-strings
-// strsep(3) a string into an array of strings.
-// Return the number of fields in the string, or -1 on error.
+// strsep2arr - string separate to array-of-strings
 inline ssize_t
 strsep2arr(char *s, const char *restrict delim, size_t n, char *a[restrict n])
 {
index 37f6ab2f862bcb92669b655191299778eb0fdfa7..ff9e75b885e0f6489a83e30c0a92f5119ff37f19 100644 (file)
@@ -97,7 +97,7 @@ subordinate_parse(const char *line)
                return NULL;    /* fail if too long */
        strcpy (rangebuf, line);
 
-       if (STRSEP2ARR(rangebuf, ":", fields) == -1)
+       if (strsep2arr_a(rangebuf, ":", fields) == -1)
                return NULL;
 
        if (streq(fields[0], ""))
index 818f73fa233f8faafe5f24cb0411c0de4223caa6..fe2b2a9084037f308e53a68c8b5dbd8d47043953 100644 (file)
@@ -1117,7 +1117,7 @@ int main (int argc, char **argv)
                        fail_exit (EXIT_FAILURE, process_selinux);
                }
 
-               if (STRSEP2ARR(buf, ":", fields) == -1) {
+               if (strsep2arr_a(buf, ":", fields) == -1) {
                        fprintf (stderr, _("%s: line %jd: invalid line\n"),
                                 Prog, line);
                        fail_exit (EXIT_FAILURE, process_selinux);