From: Volker Lendecke Date: Thu, 2 Feb 2023 11:25:05 +0000 (+0100) Subject: lib: Simplify ms_has_wild() with strpbrk() X-Git-Tag: talloc-2.4.1~1622 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bbf2b1127b93efe655360a185567de080faa943;p=thirdparty%2Fsamba.git lib: Simplify ms_has_wild() with strpbrk() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/lib/util.c b/source3/lib/util.c index 83707b31e38..9589c8e8bb8 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1443,19 +1443,8 @@ bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent, bool ms_has_wild(const char *s) { - char c; - - while ((c = *s++)) { - switch (c) { - case '*': - case '?': - case '<': - case '>': - case '"': - return True; - } - } - return False; + const char *found = strpbrk(s, "*?<>\""); + return (found != NULL); } bool ms_has_wild_w(const smb_ucs2_t *s)