From: Jeff King Date: Thu, 01 Aug 2024 10:08:52 GMT Subject: Re: [PATCH v2 09/19] midx: teach `nth_midxed_offset()` about incremental MIDXs Message-ID: <20240801100852.GI1159276@coredump.intra.peff.net> In-Reply-To: <342ed560331d95fb0a1d86743dbb999ec7327313.1721250704.git.me@ttaylorr.com> On Wed, Jul 17, 2024 at 05:12:22PM -0400, Taylor Blau wrote: > In a similar fashion as in previous commits, teach the function > `nth_midxed_offset()` about incremental MIDXs. > > The given object `pos` is used to find the containing MIDX, and > translated back into a MIDX-local position by assigning the return value > of `midx_for_object()` to it. Makes sense. > --- a/midx.c > +++ b/midx.c > @@ -368,6 +368,8 @@ off_t nth_midxed_offset(struct multi_pack_index *m, uint32_t pos) > const unsigned char *offset_data; > uint32_t offset32; > > + pos = midx_for_object(&m, pos); > + "pos" reused again! :) It certainly makes the diffs nicer to read. -Peff