[PATCH] quote: use isalnum() to check for alphanumeric characters
- From
René Scharfe <l.s.r@web.de>
- Date
- Feb 22, 2020, 18:51 UTC
- Message-ID
- <0157c714-2d9b-7896-f5dc-232d82a46625@web.de>
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> --- quote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/quote.c b/quote.c index 24a58ba454..bcc0dbc50d 100644 --- 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; } -- 2.25.1