From 2ce6d075fa35e4ea4a581c809eca3ad5631c9079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 22 Feb 2020 19:51:19 +0100 Subject: use strpbrk(3) to search for characters from a given set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- mailinfo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mailinfo.c') 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; -- cgit v1.2.3