Re: [PATCH 07/15] sequencer: make sequencer_make_script() write its script to a strbuf
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Oct 19, 2018, 09:27 UTC
- Message-ID
- <20181019092704.GW19800@szeder.dev>
- In-Reply-To
- <xmqqzhvaz6z5.fsf@gitster-ct.c.googlers.com>
On Fri, Oct 19, 2018 at 05:16:46PM +0900, Junio C Hamano wrote:
Show 25 quoted lines
> SZEDER Gábor <szeder.dev@gmail.com> 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.