mirror of
https://github.com/git/git.git
synced 2024-05-11 13:36:10 +02:00
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>
This commit is contained in:
parent
d0654dc308
commit
2b3c430bce
2
quote.c
2
quote.c
|
@ -55,7 +55,7 @@ void sq_quote_buf_pretty(struct strbuf *dst, const char *src)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = src; *p; p++) {
|
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);
|
sq_quote_buf(dst, src);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue