Re: [PATCH v2 3/4] bundle: keep a copy of bundle file name in the in-core bundle header
- From
Jeff King <peff@peff.net>
- Date
- Mar 2, 2016, 20:49 UTC
- Message-ID
- <20160302204947.GA6608@sigill.intra.peff.net>
- In-Reply-To
- <1456950761-19759-4-git-send-email-gitster@pobox.com>
On Wed, Mar 02, 2016 at 12:32:40PM -0800, Junio C Hamano wrote:
> + free((void *)header->filename);
This cast is necessary, because...
Show 12 quoted lines
> diff --git a/bundle.h b/bundle.h
> index f7ce23b..e059ccf 100644
> --- a/bundle.h
> +++ b/bundle.h
> @@ -10,12 +10,14 @@ struct ref_list {
> };
>
> struct bundle_header {
> + const char *filename;
> struct ref_list prerequisites;
> struct ref_list references;
> };...this is const, even though we know it is allocated on the heap.
I am OK if we want to keep it "conceptually const" so that anybody looking at the struct knows they should not touch it. But I am also OK with just making it "char *".
-Peff