From 38e295153241ee55dddd5b7ab570e16ef2f60f85 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 1 Jan 2025 01:04:38 +0100 Subject: [PATCH] lib/: Treat strpbrk(3)'s return value as a boolean with the meaning "a character was found". strpbrk(3) is just like strchr(3), but searches for multiple characters. Both functions have a boolean-like return value, which evaluates to true if a character was found. A better name for strpbrk(3) would have been strchrs(). Signed-off-by: Alejandro Colomar --- lib/fields.c | 2 +- lib/setupenv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fields.c b/lib/fields.c index 9e08adadf..ef8283741 100644 --- a/lib/fields.c +++ b/lib/fields.c @@ -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; } diff --git a/lib/setupenv.c b/lib/setupenv.c index 1bc3da314..29e2aac3c 100644 --- a/lib/setupenv.c +++ b/lib/setupenv.c @@ -73,7 +73,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 :-) */ /* -- 2.47.2