Re: [PATCH 5/5] diff: store graph prefix buf in git_graph struct

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

 



On Thu, Oct 03, 2024 at 04:43:40PM -0700, Junio C Hamano wrote:
> Jeff King <peff@xxxxxxxx> writes:
> 
> > Since we only need the strbuf when we are formatting graph padding, we
> > can give ownership of the strbuf to the git_graph struct, letting us
> > free it when that struct is no longer in use.
> >
> >  static const char *diff_output_prefix_callback(struct diff_options *opt, void *data)
> >  {
> >  	struct git_graph *graph = data;
> > -	static struct strbuf msgbuf = STRBUF_INIT;
> >  
> >  	assert(opt);
> >  
> >  	if (!graph)
> >  		return opt->line_prefix;
> >  
> > -	strbuf_reset(&msgbuf);
> 
> Oooh, I love this change.  The fewer file scope statics (or global
> states in general) we have, the better ;-).

True, thanks for going the extra mile here! The other patches look good
to me, as well.

Patrick




[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