lib/, src/: Use stpspn() instead of its pattern
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
9035932496
commit
f45adadd28
+2
-6
@@ -16,6 +16,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "prototypes.h"
|
||||
#include "string/strchr/stpspn.h"
|
||||
#include "string/strchr/strrspn.h"
|
||||
#include "string/strtok/stpsep.h"
|
||||
|
||||
@@ -91,12 +92,7 @@ void change_field (char *buf, size_t maxsize, const char *prompt)
|
||||
* entering a space. --marekm
|
||||
*/
|
||||
stpcpy(strrspn(newf, " \t\n"), "");
|
||||
|
||||
cp = newf;
|
||||
while (isspace (*cp)) {
|
||||
cp++;
|
||||
}
|
||||
|
||||
cp = stpspn(newf, " \t");
|
||||
strcpy (buf, cp);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -24,14 +24,15 @@
|
||||
# undef static
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "attr.h"
|
||||
#include "getdate.h"
|
||||
#include "string/strchr/stpspn.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Some old versions of bison generate parsers that use bcopy.
|
||||
That loses on systems that don't provide the function, so we have
|
||||
@@ -746,8 +747,7 @@ yylex (void)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
while (isspace (*yyInput))
|
||||
yyInput++;
|
||||
yyInput = stpspn(yyInput, " \t");
|
||||
|
||||
if (isdigit (c = *yyInput) || c == '-' || c == '+')
|
||||
{
|
||||
|
||||
+3
-11
@@ -36,6 +36,7 @@
|
||||
#include "atoi/str2i/str2s.h"
|
||||
#include "atoi/str2i/str2u.h"
|
||||
#include "string/memset/memzero.h"
|
||||
#include "string/strchr/stpspn.h"
|
||||
#include "typetraits.h"
|
||||
|
||||
|
||||
@@ -185,11 +186,7 @@ static int do_user_limits (const char *buf, const char *name)
|
||||
int retval = 0;
|
||||
bool reported = false;
|
||||
|
||||
pp = buf;
|
||||
/* Skip leading whitespace. */
|
||||
while ((' ' == *pp) || ('\t' == *pp)) {
|
||||
pp++;
|
||||
}
|
||||
pp = stpspn(buf, " \t");
|
||||
|
||||
/* The special limit string "-" results in no limit for all known
|
||||
* limits.
|
||||
@@ -313,12 +310,7 @@ static int do_user_limits (const char *buf, const char *name)
|
||||
* So, let's skip all digits, "-" and our limited set of
|
||||
* whitespace.
|
||||
*/
|
||||
while ( isdigit (*pp)
|
||||
|| ('-' == *pp)
|
||||
|| (' ' == *pp)
|
||||
|| ('\t' ==*pp)) {
|
||||
pp++;
|
||||
}
|
||||
pp = stpspn(pp, "0123456789- \t");
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@
|
||||
#include "getdef.h"
|
||||
#include "prototypes.h"
|
||||
#include "string/memset/memzero.h"
|
||||
#include "string/strchr/stpspn.h"
|
||||
#include "string/strtok/stpsep.h"
|
||||
|
||||
|
||||
@@ -93,7 +94,7 @@ void login_prompt (char *name, int namesize)
|
||||
* Then copy the rest (up to the end) into the username.
|
||||
*/
|
||||
|
||||
for (cp = buf; *cp == ' ' || *cp == '\t'; cp++);
|
||||
cp = stpspn(buf, " \t");
|
||||
|
||||
for (i = 0; i < namesize - 1 && *cp != '\0'; name[i++] = *cp++);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "shadowlog.h"
|
||||
#include "string/sprintf/snprintf.h"
|
||||
#include "string/strtok/stpsep.h"
|
||||
#include "string/strchr/stpspn.h"
|
||||
|
||||
|
||||
#define NSSWITCH "/etc/nsswitch.conf"
|
||||
@@ -84,8 +85,7 @@ nss_init(const char *nsswitch_path) {
|
||||
if (strncasecmp(line, "subid:", 6) != 0)
|
||||
continue;
|
||||
p = &line[6];
|
||||
while (isspace(*p))
|
||||
p++;
|
||||
p = stpspn(p, " \t\n");
|
||||
if (*p != '\0')
|
||||
break;
|
||||
p = NULL;
|
||||
|
||||
+2
-3
@@ -27,6 +27,7 @@
|
||||
#include "getdef.h"
|
||||
#include "shadowlog.h"
|
||||
#include "string/sprintf/xasprintf.h"
|
||||
#include "string/strchr/stpspn.h"
|
||||
#include "string/strdup/xstrdup.h"
|
||||
#include "string/strtok/stpsep.h"
|
||||
|
||||
@@ -58,9 +59,7 @@ static void read_env_file (const char *filename)
|
||||
|
||||
cp = buf;
|
||||
/* ignore whitespace and comments */
|
||||
while (isspace (*cp)) {
|
||||
cp++;
|
||||
}
|
||||
cp = stpspn(cp, " \t");
|
||||
if (('\0' == *cp) || ('#' == *cp)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
+3
-4
@@ -14,8 +14,9 @@
|
||||
#ident "$Id$"
|
||||
|
||||
#include "atoi/str2i/str2s.h"
|
||||
#include "prototypes.h"
|
||||
#include "getdate.h"
|
||||
#include "prototypes.h"
|
||||
#include "string/strchr/stpspn.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -53,9 +54,7 @@ long strtoday (const char *str)
|
||||
if ('-' == *s) {
|
||||
s++;
|
||||
}
|
||||
while (' ' == *s) {
|
||||
s++;
|
||||
}
|
||||
s = stpspn(s, " ");
|
||||
while (isnum && ('\0' != *s)) {
|
||||
if (!isdigit (*s)) {
|
||||
isnum = false;
|
||||
|
||||
Reference in New Issue
Block a user