Re: [PATCH 07/15] sequencer: make sequencer_make_script() write its script to a strbuf
From: SZEDER Gábor <hidden>
Date: 2018-10-12 10:01:10
On Sun, Oct 07, 2018 at 09:54:10PM +0200, Alban Gruin wrote:
quoted hunk ↗ jump to hunk
diff --git a/sequencer.c b/sequencer.c index 30a7fe3958..dfb8d1c974 100644 --- a/sequencer.c +++ b/sequencer.c@@ -4083,7 +4083,7 @@ static const char *label_oid(struct object_id *oid, const char *label, } static int make_script_with_merges(struct pretty_print_context *pp, - struct rev_info *revs, FILE *out, + struct rev_info *revs, struct strbuf *out, unsigned flags) { int keep_empty = flags & TODO_LIST_KEEP_EMPTY;@@ -4230,7 +4230,7 @@ static int make_script_with_merges(struct pretty_print_context *pp, * gathering commits not yet shown, reversing the list on the fly, * then outputting that list (labeling revisions as needed). */ - fprintf(out, "%s onto\n", cmd_label); + strbuf_addf(out, "%s onto\n", cmd_label); for (iter = tips; iter; iter = iter->next) { struct commit_list *list = NULL, *iter2;@@ -4240,9 +4240,9 @@ static int make_script_with_merges(struct pretty_print_context *pp, entry = oidmap_get(&state.commit2label, &commit->object.oid); 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. Or strbuf_complete_line()? Dunno, as seen in the previous hunk, 'out' won't be empty at this point.