use strbuf_addstr() instead of strbuf_addf() with "%s"
authorRené Scharfe <l.s.r@web.de>
Fri, 5 Aug 2016 20:37:11 +0000 (22:37 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Aug 2016 22:09:25 +0000 (15:09 -0700)
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>
builtin/fmt-merge-msg.c
http.c
sequencer.c
index e5658c320ee45c208d4087e2b9761f38e0aeca92..ac84e99f3a6c073409ab7514aacdad7e722c6255 100644 (file)
@@ -272,7 +272,7 @@ static int cmp_string_list_util_as_integral(const void *a_, const void *b_)
 static void add_people_count(struct strbuf *out, struct string_list *people)
 {
        if (people->nr == 1)
-               strbuf_addf(out, "%s", people->items[0].string);
+               strbuf_addstr(out, people->items[0].string);
        else if (people->nr == 2)
                strbuf_addf(out, "%s (%d) and %s (%d)",
                            people->items[0].string,
diff --git a/http.c b/http.c
index df6dd01594a0c7bacbb9beacec683072de38a5b1..d8e427b69b43a8cc0607893e59891fc8a4356f51 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1105,7 +1105,7 @@ void append_remote_object_url(struct strbuf *buf, const char *url,
 
        strbuf_addf(buf, "objects/%.*s/", 2, hex);
        if (!only_two_digit_prefix)
-               strbuf_addf(buf, "%s", hex+2);
+               strbuf_addstr(buf, hex + 2);
 }
 
 char *get_remote_object_url(const char *url, const char *hex,
index a33c39b64fbd9cf42e5bd531488f7d2366bd167b..80a17bb3bd01064c80550e6e302750c9e9c3a7ad 100644 (file)
@@ -112,7 +112,7 @@ static void remove_sequencer_state(void)
 {
        struct strbuf seq_dir = STRBUF_INIT;
 
-       strbuf_addf(&seq_dir, "%s", git_path(SEQ_DIR));
+       strbuf_addstr(&seq_dir, git_path(SEQ_DIR));
        remove_dir_recursively(&seq_dir, 0);
        strbuf_release(&seq_dir);
 }