Re: [PATCH v5 3/4] object-file: emit corruption errors when detected
- From
Jeff King <peff@peff.net>
- Date
- Dec 13, 2022, 10:38 UTC
- Message-ID
- <Y5hWCa31OVLOU3sK@coredump.intra.peff.net>
- In-Reply-To
- <xmqqzgbsoyte.fsf@gitster.g>
On Tue, Dec 13, 2022 at 10:51:57AM +0900, Junio C Hamano wrote:
Show 17 quoted lines
> Jonathan Tan <jonathantanmy@google.com> writes:
>
> > diff --git a/object-file.c b/object-file.c
> > index 429e3a746d..e0cef8b906 100644
> > --- a/object-file.c
> > +++ b/object-file.c
> > @@ -1422,7 +1422,9 @@ static int loose_object_info(struct repository *r,
> > struct object_info *oi, int flags)
> > {
> > int status = 0;
> > + int fd;
> > unsigned long mapsize;
> > + const char *path = NULL;
>
> It may be OK to leave this uninitialized, as long as the contract of
> open_loose_object() is that a successful opening will report the path
> to the loose object file that was opened. Because ...Yeah, I'd agree that this initialization can be left off (and that the NULL checks later in the function are not needed).
-Peff