Subject: Re: [PATCH 07/15] sequencer: make sequencer_make_script() write its script to a strbuf

From: SZEDER Gábor <[email-masked]>
Date: Fri, 19 Oct 2018 11:27:04 +0200

On Fri, Oct 19, 2018 at 05:16:46PM +0900, Junio C Hamano wrote:
> SZEDER Gábor <[email-masked]> writes:
> 
> >>  		if (entry)
> >> -			fprintf(out, "\n%c Branch %s\n", comment_line_char, entry->string);
> >> +			strbuf_addf(out, "\n%c Branch %s\n", comment_line_char, entry->string);
> >>  		else
> >> -			fprintf(out, "\n");
> >> +			strbuf_addf(out, "\n");
> >
> > Please use plain strbuf_add() here.
> 
> FWIW, contrib/coccinelle/strbuf.cocci.patch gave us this:
> 
> diff -u -p a/sequencer.c b/sequencer.c
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -4311,7 +4311,7 @@ static int make_script_with_merges(struc
>  		if (entry)
>  			strbuf_addf(out, "\n%c Branch %s\n", comment_line_char, entry->string);
>  		else
> -			strbuf_addf(out, "\n");
> +			strbuf_addstr(out, "\n");
>  
>  		while (oidset_contains(&interesting, &commit->object.oid) &&
>  		       !oidset_contains(&shown, &commit->object.oid)) {

Uh, right.  I didn't want to copy-paste a patch with too long lines
into my mailer, as it usually doesn't end too good, so I just typed
the function name.  Evidently I couldn't quite manage.