diff options
| author | René Scharfe <l.s.r@web.de> | 2020-02-22 19:51:19 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2020-02-24 09:30:31 -0800 |
| commit | 2ce6d075fa35e4ea4a581c809eca3ad5631c9079 (patch) | |
| tree | 163d09de764ab4a8ac97037eeebbc8108a3a6b36 /builtin/show-branch.c | |
| parent | quote: use isalnum() to check for alphanumeric characters (diff) | |
| download | git-2ce6d075fa35e4ea4a581c809eca3ad5631c9079.tar.gz git-2ce6d075fa35e4ea4a581c809eca3ad5631c9079.zip | |
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>
Diffstat (limited to 'builtin/show-branch.c')
| -rw-r--r-- | builtin/show-branch.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 35d7f51c23..8c90cbb18f 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -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; |
