Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/: Simplify, using strpbrk(3) #1167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fields.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int valid_field (const char *field, const char *illegal)

/* For each character of field, search if it appears in the list
* of illegal characters. */
if (illegal && NULL != strpbrk (field, illegal)) {
if (illegal && strpbrk(field, illegal)) {
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/setupenv.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static void read_env_file (const char *filename)
val = stpsep(cp, "=");
if (val == NULL)
continue;
if (strpbrk(name, " \t") != NULL)
if (strpbrk(name, " \t"))
continue;
#if 0 /* XXX untested, and needs rewrite with fewer goto's :-) */
/*
Expand Down
2 changes: 1 addition & 1 deletion src/useradd.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static const char *def_log_init = "yes";
static long def_inactive = -1;
static const char *def_expire = "";

#define VALID(s) (strcspn (s, ":\n") == strlen (s))
#define VALID(s) (!strpbrk(s, ":\n"))

static const char *user_name = "";
static const char *user_pass = "!";
Expand Down
2 changes: 1 addition & 1 deletion src/usermod.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
#define E_SUB_GID_UPDATE 18 /* can't update the subordinate gid file */
#endif /* ENABLE_SUBIDS */

#define VALID(s) (strcspn (s, ":\n") == strlen (s))
#define VALID(s) (!strpbrk(s, ":\n"))

/*
* Global variables
Expand Down
Loading