{"thread":{"id":"52867","subject":"[PATCH] quote: use isalnum() to check for alphanumeric characters","startedAt":"2020-02-22T18:51:23Z","lastAt":"2020-02-23T09:14:12Z","messageCount":2,"participants":["René Scharfe","Martin Ågren"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"392307","messageId":"0157c714-2d9b-7896-f5dc-232d82a46625@web.de","threadId":"52867","inReplyTo":null,"subject":"[PATCH] quote: use isalnum() to check for alphanumeric characters","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2020-02-22T18:51:13Z","receivedAt":"2020-02-22T18:51:23Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"isalnum(c) is equivalent to isalpha(c) || isdigit(c), so use the\nformer instead.  The result is shorter, simpler and slightly more\nefficient.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n quote.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/quote.c b/quote.c\nindex 24a58ba454..bcc0dbc50d 100644\n--- a/quote.c\n+++ b/quote.c\n@@ -55,7 +55,7 @@ void sq_quote_buf_pretty(struct strbuf *dst, const char *src)\n \t}\n\n \tfor (p = src; *p; p++) {\n-\t\tif (!isalpha(*p) && !isdigit(*p) && !strchr(ok_punct, *p)) {\n+\t\tif (!isalnum(*p) && !strchr(ok_punct, *p)) {\n \t\t\tsq_quote_buf(dst, src);\n \t\t\treturn;\n \t\t}\n--\n2.25.1\n"},{"id":"392350","messageId":"CAN0heSr+S6FTVrjfa9ZQipyKjv611-DCLZpQPjJUm+T4sMM47w@mail.gmail.com","threadId":"52867","inReplyTo":"0157c714-2d9b-7896-f5dc-232d82a46625@web.de","subject":"Re: [PATCH] quote: use isalnum() to check for alphanumeric characters","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2020-02-23T09:13:57Z","receivedAt":"2020-02-23T09:14:12Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"On Sat, 22 Feb 2020 at 19:53, René Scharfe <l.s.r@web.de> wrote:\n>\n> isalnum(c) is equivalent to isalpha(c) || isdigit(c), so use the\n> former instead.  The result is shorter, simpler and slightly more\n> efficient.\n\nFrom git-compat-util.h I can see that the claim about equivalence is\ncorrect. And the efficiency claim, too. And agreed on \"shorter and\nsimpler\".\n\n> --- a/quote.c\n> +++ b/quote.c\n> @@ -55,7 +55,7 @@ void sq_quote_buf_pretty(struct strbuf *dst, const char *src)\n>         }\n>\n>         for (p = src; *p; p++) {\n> -               if (!isalpha(*p) && !isdigit(*p) && !strchr(ok_punct, *p)) {\n> +               if (!isalnum(*p) && !strchr(ok_punct, *p)) {\n\nI failed to identify any similar constructs. Looks good to me.\n\nMartin\n"}]}