From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: "René Scharfe" <l.s.r@web.de>, "Git List" <git@vger.kernel.org>
Subject: Re: [PATCH] pack-objects: use strcspn(3) in name_cmp_len()
Date: Mon, 06 Feb 2023 14:35:27 -0800 [thread overview]
Message-ID: <xmqqr0v22zio.fsf@gitster.g> (raw)
In-Reply-To: <230205.86357j95wj.gmgdl@evledraar.gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Sun, 05 Feb 2023 21:59:10 +0100")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> I wonder if this name_cmp_len() is worth keeping at all. If all we're
> doing is wrapping strcspn() (which b.t.w, seem to be less "open-coding"
> and just that it wasn't known to the original author in 5d4a6003354
> (Make git-pack-objects a builtin, 2006-08-03)), then just inlining that
> in the two name_cmp_len() invocations would be better, or maybe:
Even if the stop candidate bytes were a constant, or if there were
only a single callsite, I am not sure if it is a good idea, simply
because with this
> strcspn(..., object_reject);
or with a literal "\n/" to make it easier to see where in the string
we are stopping, it is hard without named function to tell what
length we are computing.
The function being file-scope static, decent compilers hopefully
would inline the calls by two callers.
prev parent reply other threads:[~2023-02-06 22:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-05 10:42 [PATCH] pack-objects: use strcspn(3) in name_cmp_len() René Scharfe
2023-02-05 20:59 ` Ævar Arnfjörð Bjarmason
2023-02-06 22:35 ` Junio C Hamano [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=xmqqr0v22zio.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).