lib/getdef.c: def_load(): Use stp[c]spn() instead of their patterns

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-05-19 01:00:21 +02:00
committed by Serge Hallyn
parent 2fcf520184
commit 9174697469
+5 -3
View 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';
/*