Subject: Re: [PATCH v2 3/5] list-objects-filter: use oidmap_clear_with_free() for cleanup

From: Patrick Steinhardt <[email-masked]>
Date: Wed, 4 Mar 2026 07:57:46 +0100

On Mon, Mar 02, 2026 at 02:30:07PM -0800, Junio C Hamano wrote:
> Seyi Kuforiji <[email-masked]> 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