use strpbrk(3) to search for characters from a given set

We can check if certain characters are present in a string by calling
strchr(3) on each of them, or we can pass them all to a single
strpbrk(3) call.  The latter is shorter, less repetitive and slightly
more efficient, so let's do that instead.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2020-02-22 19:51:19 +01:00
committed by Junio C Hamano
parent 2b3c430bce
commit 2ce6d075fa
4 changed files with 4 additions and 5 deletions

View File

@ -536,7 +536,7 @@ static void append_one_rev(const char *av)
append_ref(av, &revkey, 0);
return;
}
if (strchr(av, '*') || strchr(av, '?') || strchr(av, '[')) {
if (strpbrk(av, "*?[")) {
/* glob style match */
int saved_matches = ref_name_cnt;