diff options
author | René Scharfe <l.s.r@web.de> | 2020-02-22 21:51:19 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-24 20:30:31 +0300 |
commit | 2ce6d075fa35e4ea4a581c809eca3ad5631c9079 (patch) | |
tree | 163d09de764ab4a8ac97037eeebbc8108a3a6b36 /mailinfo.c | |
parent | 2b3c430bcea5d8c40b218c7e2a71d261822c6a52 (diff) |
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 'mailinfo.c')
-rw-r--r-- | mailinfo.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/mailinfo.c b/mailinfo.c index b395adbdf2..eeef190c3d 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -19,8 +19,7 @@ static void cleanup_space(struct strbuf *sb) static void get_sane_name(struct strbuf *out, struct strbuf *name, struct strbuf *email) { struct strbuf *src = name; - if (name->len < 3 || 60 < name->len || strchr(name->buf, '@') || - strchr(name->buf, '<') || strchr(name->buf, '>')) + if (name->len < 3 || 60 < name->len || strpbrk(name->buf, "@<>")) src = email; else if (name == out) return; |