@matheusbsbs / matheus-bagliano / commits / 2b3c430bce
Fork 0

quote: use isalnum() to check for alphanumeric characters

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>

René Scharfe committed Feb 22, 2020 at 19:51 UTC 2b3c430bcea5d8c40b218c7e2a71d261822c6a52
1 file changed +1 -1
quote.c
+1 -1
@@ -55,7 +55,7 @@ void sq_quote_buf_pretty(struct strbuf *dst, const char *src)
55 }
56
57 for (p = src; *p; p++) {
58 - if (!isalpha(*p) && !isdigit(*p) && !strchr(ok_punct, *p)) {
58 + if (!isalnum(*p) && !strchr(ok_punct, *p)) {
59 sq_quote_buf(dst, src);
60 return;
61 }