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>
This commit is contained in:
René Scharfe 2017-10-01 16:44:20 +02:00 коммит произвёл Junio C Hamano
Родитель fa2bb34477
Коммит 72d4a9a721
3 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -352,7 +352,7 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
strbuf_addf(&obname, "%%(objectname:short=%d)", filter->abbrev); strbuf_addf(&obname, "%%(objectname:short=%d)", filter->abbrev);
strbuf_addf(&local, "%%(align:%d,left)%%(refname:lstrip=2)%%(end)", maxwidth); strbuf_addf(&local, "%%(align:%d,left)%%(refname:lstrip=2)%%(end)", maxwidth);
strbuf_addf(&local, "%s", branch_get_color(BRANCH_COLOR_RESET)); strbuf_addstr(&local, branch_get_color(BRANCH_COLOR_RESET));
strbuf_addf(&local, " %s ", obname.buf); strbuf_addf(&local, " %s ", obname.buf);
if (filter->verbose > 1) if (filter->verbose > 1)

Просмотреть файл

@ -729,8 +729,8 @@ static int write_with_updates(struct packed_ref_store *refs,
} }
if (ok != ITER_DONE) { if (ok != ITER_DONE) {
strbuf_addf(err, "unable to write packed-refs file: " strbuf_addstr(err, "unable to write packed-refs file: "
"error iterating over old contents"); "error iterating over old contents");
goto error; goto error;
} }

Просмотреть файл

@ -203,7 +203,7 @@ int sequencer_remove_state(struct replay_opts *opts)
free(opts->xopts[i]); free(opts->xopts[i]);
free(opts->xopts); free(opts->xopts);
strbuf_addf(&dir, "%s", get_dir(opts)); strbuf_addstr(&dir, get_dir(opts));
remove_dir_recursively(&dir, 0); remove_dir_recursively(&dir, 0);
strbuf_release(&dir); strbuf_release(&dir);