]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/getdef.c: def_load(): Use stp[c]spn() instead of their patterns
authorAlejandro Colomar <alx@kernel.org>
Sat, 18 May 2024 23:00:21 +0000 (01:00 +0200)
committerSerge Hallyn <serge@hallyn.com>
Wed, 3 Jul 2024 15:03:12 +0000 (10:03 -0500)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/getdef.c

index cc635ae73f7ae164c7e3cb2e331eb6aa3a2aed0d..459fdc99c24e1e312a38ce306f5e58a346bb3213 100644 (file)
@@ -29,6 +29,8 @@
 #include "prototypes.h"
 #include "shadowlog_internal.h"
 #include "string/sprintf/xasprintf.h"
+#include "string/strchr/stpcspn.h"
+#include "string/strchr/stpspn.h"
 
 
 /*
@@ -569,16 +571,16 @@ static void def_load (void)
                /*
                 * Break the line into two fields.
                 */
-               name = buf + strspn (buf, " \t");       /* first nonwhite */
+               name = stpspn(buf, " \t");      /* first nonwhite */
                if (*name == '\0' || *name == '#')
                        continue;       /* comment or empty */
 
-               s = name + strcspn (name, " \t");       /* end of field */
+               s = stpcspn(name, " \t");       /* end of field */
                if (*s == '\0')
                        continue;       /* only 1 field?? */
 
                *s++ = '\0';
-               value = s + strspn (s, " \"\t");        /* next nonwhite */
+               value = stpspn(s, " \"\t");     /* next nonwhite */
                *strchrnul(value, '"') = '\0';
 
                /*