summaryrefslogtreecommitdiff
path: root/t/helper
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2020-02-22 18:51:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-24 17:30:31 (GMT)
commit2ce6d075fa35e4ea4a581c809eca3ad5631c9079 (patch)
tree163d09de764ab4a8ac97037eeebbc8108a3a6b36 /t/helper
parent2b3c430bcea5d8c40b218c7e2a71d261822c6a52 (diff)
downloadgit-2ce6d075fa35e4ea4a581c809eca3ad5631c9079.zip
git-2ce6d075fa35e4ea4a581c809eca3ad5631c9079.tar.gz
git-2ce6d075fa35e4ea4a581c809eca3ad5631c9079.tar.bz2
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 't/helper')
-rw-r--r--t/helper/test-windows-named-pipe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/helper/test-windows-named-pipe.c b/t/helper/test-windows-named-pipe.c
index b4b752b..ae52183 100644
--- a/t/helper/test-windows-named-pipe.c
+++ b/t/helper/test-windows-named-pipe.c
@@ -19,7 +19,7 @@ int cmd__windows_named_pipe(int argc, const char **argv)
if (argc < 2)
goto print_usage;
filename = argv[1];
- if (strchr(filename, '/') || strchr(filename, '\\'))
+ if (strpbrk(filename, "/\\"))
goto print_usage;
strbuf_addf(&pathname, "//./pipe/%s", filename);