use strbuf_addstr() for adding constant strings to a strbuf
authorRené Scharfe <l.s.r@web.de>
Sat, 30 Jul 2016 17:36:23 +0000 (19:36 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Aug 2016 20:42:10 +0000 (13:42 -0700)
Replace uses of strbuf_addf() for adding strings with more lightweight
strbuf_addstr() calls.

In http-push.c it becomes easier to see what's going on without having
to verfiy that the definition of PROPFIND_ALL_REQUEST doesn't contain
any format specifiers.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rev-parse.c
http-push.c
send-pack.c
t/helper/test-run-command.c
index c961b74c5aaae41153b89f4e877437ba7f0d70c7..76cf05e2ade4348b8ad59b1541b58f671e53e1ce 100644 (file)
@@ -469,7 +469,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
                        (stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0) |
                        PARSE_OPT_SHELL_EVAL);
 
-       strbuf_addf(&parsed, " --");
+       strbuf_addstr(&parsed, " --");
        sq_quote_argv(&parsed, argv, 0);
        puts(parsed.buf);
        return 0;
index a092f0288bd6944be036a1a051a0954216c382e6..d0b29ac982028a26c97ebd24f1b3f2cbf188e503 100644 (file)
@@ -1137,7 +1137,7 @@ static void remote_ls(const char *path, int flags,
        ls.userData = userData;
        ls.userFunc = userFunc;
 
-       strbuf_addf(&out_buffer.buf, PROPFIND_ALL_REQUEST);
+       strbuf_addstr(&out_buffer.buf, PROPFIND_ALL_REQUEST);
 
        dav_headers = curl_slist_append(dav_headers, "Depth: 1");
        dav_headers = curl_slist_append(dav_headers, "Content-Type: text/xml");
index 37ee04ea3bf41b3bc4b0b920d52449c2f6d681d7..45a2462708b0a00d3383acea48ba2b4163f5f026 100644 (file)
@@ -266,7 +266,7 @@ static int generate_push_cert(struct strbuf *req_buf,
        struct strbuf cert = STRBUF_INIT;
        int update_seen = 0;
 
-       strbuf_addf(&cert, "certificate version 0.1\n");
+       strbuf_addstr(&cert, "certificate version 0.1\n");
        strbuf_addf(&cert, "pusher %s ", signing_key);
        datestamp(&cert);
        strbuf_addch(&cert, '\n');
index 30a64a98dc8b53a3a2d7edfaa57a8ee51d5d63e7..6bb53da3c0faef2989d749d3df5c26ca3cd76b4a 100644 (file)
@@ -26,7 +26,7 @@ static int parallel_next(struct child_process *cp,
                return 0;
 
        argv_array_pushv(&cp->args, d->argv);
-       strbuf_addf(err, "preloaded output of a child\n");
+       strbuf_addstr(err, "preloaded output of a child\n");
        number_callbacks++;
        return 1;
 }
@@ -36,7 +36,7 @@ static int no_job(struct child_process *cp,
                  void *cb,
                  void **task_cb)
 {
-       strbuf_addf(err, "no further jobs available\n");
+       strbuf_addstr(err, "no further jobs available\n");
        return 0;
 }
 
@@ -45,7 +45,7 @@ static int task_finished(int result,
                         void *pp_cb,
                         void *pp_task_cb)
 {
-       strbuf_addf(err, "asking for a quick stop\n");
+       strbuf_addstr(err, "asking for a quick stop\n");
        return 1;
 }