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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Aug 5, 2016 at 22:37 UTC
bc57b9c0cc5a123365a922fa1831177e3fd607ed
3 files changed
+3
-3
builtin/fmt-merge-msg.c
+1
-1
@@ -272,7 +272,7 @@ static int cmp_string_list_util_as_integral(const void *a_, const void *b_)
272
static void add_people_count(struct strbuf *out, struct string_list *people)
273
{
274
if (people->nr == 1)
275
- strbuf_addf(out, "%s", people->items[0].string);
275
+ strbuf_addstr(out, people->items[0].string);
276
else if (people->nr == 2)
277
strbuf_addf(out, "%s (%d) and %s (%d)",
278
people->items[0].string,
http.c
+1
-1
@@ -1105,7 +1105,7 @@ void append_remote_object_url(struct strbuf *buf, const char *url,
1105
1106
strbuf_addf(buf, "objects/%.*s/", 2, hex);
1107
if (!only_two_digit_prefix)
1108
- strbuf_addf(buf, "%s", hex+2);
1108
+ strbuf_addstr(buf, hex + 2);
1109
}
1110
1111
char *get_remote_object_url(const char *url, const char *hex,
sequencer.c
+1
-1
@@ -112,7 +112,7 @@ static void remove_sequencer_state(void)
112
{
113
struct strbuf seq_dir = STRBUF_INIT;
114
115
- strbuf_addf(&seq_dir, "%s", git_path(SEQ_DIR));
115
+ strbuf_addstr(&seq_dir, git_path(SEQ_DIR));
116
remove_dir_recursively(&seq_dir, 0);
117
strbuf_release(&seq_dir);
118
}