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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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".




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux