Re: [PATCH v2 1/4] midx: access pack names through `nth_midxed_pack_name()`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 29, 2025 at 01:51:03PM -0700, Junio C Hamano wrote:
> Taylor Blau <me@xxxxxxxxxxxx> writes:
>
> > Accessing a MIDX's 'pack_names' array is somewhat error-prone when
> > dealing with incremental MIDX chains, where the (global) pack_int_id for
> > some pack may differ from the containing layer's index for that pack.
> >
> > Introduce `nth_midxed_pack_name()` in an effort to reduce a common
> > source of errors by discouraging external callers from accessing a
> > layer's `pack_names` array directly.
> >
> > Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx>
> > ---
> >  midx.c                    | 7 +++++++
> >  midx.h                    | 2 ++
> >  pack-bitmap.c             | 4 ++--
> >  t/helper/test-read-midx.c | 7 ++++---
> >  4 files changed, 15 insertions(+), 5 deletions(-)
>
> One thing I forgot to ask.  Should we expect that
>
> 	$ git grep -E -e '(\.|->)pack_names\['
>
> to give hits only from the implementation of nth_midxed_pack_name()?

I waffled on this a bit... and I think the answer is "almost". Certainly
callers outside of midx.c or midx-write.c should not be touching
"pack_names" directly.

But there are a couple of spots in midx-write.c that are really more
convenient to directly look at the pack_names array rather than going
through the accessor.

Thanks,
Taylor




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux