Re: [PATCH v2 3/5] list-objects-filter: use oidmap_clear_with_free() for cleanup
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 4, 2026, 06:57 UTC
- Message-ID
- <aafX6qva_badx_RM@pks.im>
- In-Reply-To
- <xmqq7brtyids.fsf@gitster.g>
On Mon, Mar 02, 2026 at 02:30:07PM -0800, Junio C Hamano wrote:
Show 22 quoted lines
> Seyi Kuforiji <kuforiji98@gmail.com> writes:
>
> > diff --git a/list-objects-filter.c b/list-objects-filter.c
> > index 78316e7f90..0038bfaac5 100644
> > --- a/list-objects-filter.c
> > +++ b/list-objects-filter.c
> > @@ -143,6 +143,13 @@ struct seen_map_entry {
> > size_t depth;
> > };
> >
> > +static void free_seen_map_entry(void *e)
> > +{
> > + struct seen_map_entry *entry =
> > + container_of(e, struct seen_map_entry, base);
> > + free(entry);
> > +}
>
> As there is *no* extra resources held in seen_map_entry other than
> the shell itself, this step alone does not make the code any clearer
> to follow. But if we are going to add new members to the structure
> in the future, the story will change and we'll leap the same benefit
> as we saw in [PATCH v2 2/5].Agreed. But I think with the current status quo I'd rather drop this patch though as it may otherwise make the reader scratch their head why we do the exercise in the first place.
Patrick