Skip to content

Commit 72d4a9a

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fa2bb34 commit 72d4a9a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

builtin/branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
352352
strbuf_addf(&obname, "%%(objectname:short=%d)", filter->abbrev);
353353

354354
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));
356356
strbuf_addf(&local, " %s ", obname.buf);
357357

358358
if (filter->verbose > 1)

refs/packed-backend.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,8 @@ static int write_with_updates(struct packed_ref_store *refs,
729729
}
730730

731731
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");
734734
goto error;
735735
}
736736

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ int sequencer_remove_state(struct replay_opts *opts)
203203
free(opts->xopts[i]);
204204
free(opts->xopts);
205205

206-
strbuf_addf(&dir, "%s", get_dir(opts));
206+
strbuf_addstr(&dir, get_dir(opts));
207207
remove_dir_recursively(&dir, 0);
208208
strbuf_release(&dir);
209209

0 commit comments

Comments
 (0)