From: Abhradeep Chakraborty Date: Sat, 20 Aug 2022 18:40:42 GMT Subject: Re: [PATCH 6/6] midx.c: include preferred pack correctly with existing MIDX Message-ID: In-Reply-To: <4ddddc959b042faf7ae98a8e8eaa05e77f9ea23e.1660944574.git.me@ttaylorr.com> On Sat, Aug 20, 2022 at 3:00 AM Taylor Blau wrote: > > + if (-1 < preferred_pack && preferred_pack < start_pack) > + midx_fanout_add_pack_fanout(&fanout, info, > + preferred_pack, 1, > + cur_fanout); > + All the other changes make sense to me but I have a question about this particular change. Instead of adding all the preferred objects again (but in this case these are being added from preferred pack) in `fanout->entries`, will it be better if we call `midx_fanout_add_pack_fanout()` function from `midx_fanout_add_midx_fanout()` when above conditions are met? Something like this - static void midx_fanout_add_midx_fanout(struct midx_fanout *fanout, struct multi_pack_index *m, struct pack_info *info, uint32_t cur_pack, int preferred, uint32_t cur_fanout) { ... if (cur_fanout) start = ntohl(m->chunk_oid_fanout[cur_fanout - 1]); end = ntohl(m->chunk_oid_fanout[cur_fanout]); if (preferred) { midx_fanout_add_pack_fanout(&fanout, info, cur_pack, preferred, cur_fanout); return; } for (.....) { ........ } It may reduce some extra code work but also could decrease readability of the function(may be). What's your thought here? Thanks :)