All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] quote: use isalnum() to check for alphanumeric characters
Date: Sun, 23 Feb 2020 10:13:57 +0100	[thread overview]
Message-ID: <CAN0heSr+S6FTVrjfa9ZQipyKjv611-DCLZpQPjJUm+T4sMM47w@mail.gmail.com> (raw)
In-Reply-To: <0157c714-2d9b-7896-f5dc-232d82a46625@web.de>

On Sat, 22 Feb 2020 at 19:53, René Scharfe <l.s.r@web.de> wrote:
>
> isalnum(c) is equivalent to isalpha(c) || isdigit(c), so use the
> former instead.  The result is shorter, simpler and slightly more
> efficient.

From git-compat-util.h I can see that the claim about equivalence is
correct. And the efficiency claim, too. And agreed on "shorter and
simpler".

> --- 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)) {

I failed to identify any similar constructs. Looks good to me.

Martin

      reply	other threads:[~2020-02-23  9:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-22 18:51 [PATCH] quote: use isalnum() to check for alphanumeric characters René Scharfe
2020-02-23  9:13 ` Martin Ågren [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN0heSr+S6FTVrjfa9ZQipyKjv611-DCLZpQPjJUm+T4sMM47w@mail.gmail.com \
    --to=martin.agren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.