Subject: Re: [PATCH 5/6] sequencer: duplicate the result of resolve_ref_unsafe()

From: SZEDER Gábor <[email-masked]>
Date: Sun, 9 Oct 2022 19:23:06 +0200

On Fri, Sep 30, 2022 at 01:23:27PM -0400, Derrick Stolee wrote:
> > -	const char *head_ref = resolve_ref_unsafe("HEAD",
> > +	const char *head_ref = xstrdup_or_null(resolve_ref_unsafe("HEAD",
> >  						  RESOLVE_REF_READING,
> >  						  NULL,
> > -						  NULL);
> > +						  NULL));
> 
> Moving to a 'char *' matches our typical pattern of "I am responsible
> for freeing this or passing that responsibility to someone else."

Do we really have such a misleading pattern?

To me 'char*', as opposed to 'const char*', means that "I'll modify
the buffer where this pointer points to, and I must be on the lookout 
for when and how that happens".