Skip to content

Commit 2b3c430

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d0654dc commit 2b3c430

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

quote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void sq_quote_buf_pretty(struct strbuf *dst, const char *src)
5555
}
5656

5757
for (p = src; *p; p++) {
58-
if (!isalpha(*p) && !isdigit(*p) && !strchr(ok_punct, *p)) {
58+
if (!isalnum(*p) && !strchr(ok_punct, *p)) {
5959
sq_quote_buf(dst, src);
6060
return;
6161
}

0 commit comments

Comments
 (0)