Skip to content

Commit

Permalink
quote: use isalnum() to check for alphanumeric characters
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
rscharfe authored and gitster committed Feb 24, 2020
1 parent d0654dc commit 2b3c430
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion quote.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2b3c430

Please sign in to comment.