Skip to content

Commit bc57b9c

Browse files
rscharfegitster
authored andcommitted
use strbuf_addstr() instead of strbuf_addf() with "%s"
Call strbuf_addstr() for adding a simple string to a strbuf instead of using the heavier strbuf_addf(). This is shorter and documents the intent more clearly. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 02962d3 commit bc57b9c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Diff for: builtin/fmt-merge-msg.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static int cmp_string_list_util_as_integral(const void *a_, const void *b_)
272272
static void add_people_count(struct strbuf *out, struct string_list *people)
273273
{
274274
if (people->nr == 1)
275-
strbuf_addf(out, "%s", people->items[0].string);
275+
strbuf_addstr(out, people->items[0].string);
276276
else if (people->nr == 2)
277277
strbuf_addf(out, "%s (%d) and %s (%d)",
278278
people->items[0].string,

Diff for: http.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ void append_remote_object_url(struct strbuf *buf, const char *url,
11051105

11061106
strbuf_addf(buf, "objects/%.*s/", 2, hex);
11071107
if (!only_two_digit_prefix)
1108-
strbuf_addf(buf, "%s", hex+2);
1108+
strbuf_addstr(buf, hex + 2);
11091109
}
11101110

11111111
char *get_remote_object_url(const char *url, const char *hex,

Diff for: sequencer.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static void remove_sequencer_state(void)
112112
{
113113
struct strbuf seq_dir = STRBUF_INIT;
114114

115-
strbuf_addf(&seq_dir, "%s", git_path(SEQ_DIR));
115+
strbuf_addstr(&seq_dir, git_path(SEQ_DIR));
116116
remove_dir_recursively(&seq_dir, 0);
117117
strbuf_release(&seq_dir);
118118
}

0 commit comments

Comments
 (0)