]> git.ipfire.org Git - thirdparty/git.git/commitdiff
quote: use isalnum() to check for alphanumeric characters
authorRené Scharfe <l.s.r@web.de>
Sat, 22 Feb 2020 18:51:13 +0000 (19:51 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Feb 2020 17:30:29 +0000 (09:30 -0800)
isalnum(c) is equivalent to isalpha(c) || isdigit(c), so use the
former instead.  The result is shorter, simpler and slightly more
efficient.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
quote.c

diff --git a/quote.c b/quote.c
index 24a58ba454fdfd04dd441d787ea8202ea772c02f..bcc0dbc50d9b98bb5317398505d6548c98005c2f 100644 (file)
--- a/quote.c
+++ b/quote.c
@@ -55,7 +55,7 @@ void sq_quote_buf_pretty(struct strbuf *dst, const char *src)
        }
 
        for (p = src; *p; p++) {
-               if (!isalpha(*p) && !isdigit(*p) && !strchr(ok_punct, *p)) {
+               if (!isalnum(*p) && !strchr(ok_punct, *p)) {
                        sq_quote_buf(dst, src);
                        return;
                }