git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 5/6] hash_pos(): convert to oid_pos()
Date: Thu, 28 Jan 2021 17:48:22 -0500	[thread overview]
Message-ID: <YBM/NpLeS0uFzVb3@nand.local> (raw)
In-Reply-To: <YBJXfl86Juv5kn16@coredump.intra.peff.net>

On Thu, Jan 28, 2021 at 01:19:42AM -0500, Jeff King wrote:
> All of our callers are actually looking up an object_id, not a bare
> hash. Likewise, the arrays they are looking in are actual arrays of
> object_id (not just raw bytes of hashes, as we might find in a pack
> .idx; those are handled by bsearch_hash()).
>
> Using an object_id gives us more type safety, and makes the callers
> slightly shorter. It also gets rid of the word "sha1" from several
> access functions, though we could obviously also rename those with
> s/sha1/hash/.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> If we don't want to make this change, I think it's still worth sweeping
> through the callers and changing the names of their access functions.
>
>  builtin/name-rev.c  |  8 ++++----
>  commit-graph.c      | 28 ++++++++++++++--------------
>  commit.c            | 10 +++++-----
>  hash-lookup.c       | 18 +++++++++---------
>  hash-lookup.h       | 10 +++++-----

I wondered briefly if we should rename this to oid-lookup.{c,h}, but I
think the answer is "no", since we still have bsearch_hash() in this
header.

Probably a single header with "hash" in the name is better than two
headers each containing a single function (and one containing an
additional typedef).

So, I think that what you did here is good.

Thanks,
Taylor

  reply	other threads:[~2021-01-28 22:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28  6:12 [PATCH 0/6] convert hash_pos() to oid_pos() Jeff King
2021-01-28  6:12 ` [PATCH 1/6] commit_graft_pos(): take an oid instead of a bare hash Jeff King
2021-01-28 12:57   ` Derrick Stolee
2021-01-28  6:14 ` [PATCH 2/6] rerere: check dirname format while iterating rr_cache directory Jeff King
2021-01-28  6:16 ` [PATCH 3/6] rerere: tighten rr-cache dirname check Jeff King
2021-01-28 22:35   ` Taylor Blau
2021-01-28  6:19 ` [PATCH 4/6] rerere: use strmap to store rerere directories Jeff King
2021-01-28  6:34   ` Jeff King
2021-01-28 19:52     ` Junio C Hamano
2021-01-28  6:38   ` Junio C Hamano
2021-01-28  6:51     ` Jeff King
2021-01-28  6:19 ` [PATCH 5/6] hash_pos(): convert to oid_pos() Jeff King
2021-01-28 22:48   ` Taylor Blau [this message]
2021-01-29  1:18     ` Jeff King
2021-01-28  6:20 ` [PATCH 6/6] oid_pos(): access table through const pointers Jeff King

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=YBM/NpLeS0uFzVb3@nand.local \
    --to=me@ttaylorr.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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).