use strbuf_addstr() for adding strings to strbufs

Use strbuf_addstr() instead of strbuf_addf() for adding strings. That's simpler and makes the intent clearer. Patch generated by Coccinelle and contrib/coccinelle/strbuf.cocci; adjusted indentation in refs/packed-backend.c manually. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Oct 1, 2017 at 16:44 UTC 72d4a9a721d519982cbc97c36f3fcf33b4103ed4
3 files changed +4 -4
builtin/branch.c
+1 -1
@@ -352,7 +352,7 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
352 strbuf_addf(&obname, "%%(objectname:short=%d)", filter->abbrev);
353
354 strbuf_addf(&local, "%%(align:%d,left)%%(refname:lstrip=2)%%(end)", maxwidth);
355 - strbuf_addf(&local, "%s", branch_get_color(BRANCH_COLOR_RESET));
355 + strbuf_addstr(&local, branch_get_color(BRANCH_COLOR_RESET));
356 strbuf_addf(&local, " %s ", obname.buf);
357
358 if (filter->verbose > 1)
refs/packed-backend.c
+2 -2
@@ -729,8 +729,8 @@ static int write_with_updates(struct packed_ref_store *refs,
729 }
730
731 if (ok != ITER_DONE) {
732 - strbuf_addf(err, "unable to write packed-refs file: "
733 - "error iterating over old contents");
732 + strbuf_addstr(err, "unable to write packed-refs file: "
733 + "error iterating over old contents");
734 goto error;
735 }
736
sequencer.c
+1 -1
@@ -203,7 +203,7 @@ int sequencer_remove_state(struct replay_opts *opts)
203 free(opts->xopts[i]);
204 free(opts->xopts);
205
206 - strbuf_addf(&dir, "%s", get_dir(opts));
206 + strbuf_addstr(&dir, get_dir(opts));
207 remove_dir_recursively(&dir, 0);
208 strbuf_release(&dir);
209