Re: [PATCH 05/21] trailer: rename 'free_all' to 'free_all_trailer_items'
- From
Jeff King <peff@peff.net>
- Date
- Nov 10, 2020, 19:52 UTC
- Message-ID
- <20201110195219.GB1987088@coredump.intra.peff.net>
- In-Reply-To
- <CAP8UFD0Fpkj_xc-UBCeayw2C_4eXCx7Kan90PCvoM-KUMVEGDA@mail.gmail.com>
On Mon, Oct 26, 2020 at 01:42:25PM +0100, Christian Couder wrote:
Show 6 quoted lines
> > No functional change intended. > > This doesn't explain much why renaming 'free_all' to > 'free_all_trailer_items' is a good idea. Is the function specific to > trailer items or is it generic enough to be useful on other 'struct > list_head *head'?
It can't be generic, because list_head needs to use the expected containing type to find the containing pointer. So free_all() is quite a bad name, even within trailer.c, because the compiler won't even tell you if you pass a different list to it.
I do agree this should be spelled out in the commit message, though. :)
-Peff