Re: [PATCH 1/9] csum-file: drop discard_hashfile()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 2, 2026, 18:19 UTC
- Message-ID
- <xmqqik6xl0fb.fsf@gitster.g>
- In-Reply-To
- <20260702075744.GA2029434@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 16 quoted lines
> So now we have two functions, discard_hashfile() and free_hashfile(), > and we only need one. Which one do we want to keep? > > The only difference between them is that the discard variant also closes > the descriptors held in the struct. Let's look at the three callers: > ... > Note that I said "descriptors" plural above. Those callers all care > about the "fd" member of the struct. But discard_hashfile() also closes > check_fd. That is only used if the struct is initialized with > hashfd_check(), and neither of its two callers call either discard or > free (they always "finalize" instead). So closing it is irrelevant for > the current callers. > > I think we're better off sticking with the simpler free_hashfile() > interface, and the handful of callers can decide how to handle the > descriptors themselves.
Sonds good.
Our resident naming czar (already Cc'ed) may have preference about the names and word order, though ;-)