use strbuf_addstr() for adding constant strings to a strbuf
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>
René Scharfe committed
Jul 30, 2016 at 19:36 UTC
02962d36845b89145cd69f8bc65e015d78ae3434
4 files changed
+6
-6
builtin/rev-parse.c
+1
-1
@@ -469,7 +469,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
469
(stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0) |
470
PARSE_OPT_SHELL_EVAL);
471
472
- strbuf_addf(&parsed, " --");
472
+ strbuf_addstr(&parsed, " --");
473
sq_quote_argv(&parsed, argv, 0);
474
puts(parsed.buf);
475
return 0;
http-push.c
+1
-1
@@ -1137,7 +1137,7 @@ static void remote_ls(const char *path, int flags,
1137
ls.userData = userData;
1138
ls.userFunc = userFunc;
1139
1140
- strbuf_addf(&out_buffer.buf, PROPFIND_ALL_REQUEST);
1140
+ strbuf_addstr(&out_buffer.buf, PROPFIND_ALL_REQUEST);
1141
1142
dav_headers = curl_slist_append(dav_headers, "Depth: 1");
1143
dav_headers = curl_slist_append(dav_headers, "Content-Type: text/xml");
send-pack.c
+1
-1
@@ -266,7 +266,7 @@ static int generate_push_cert(struct strbuf *req_buf,
266
struct strbuf cert = STRBUF_INIT;
267
int update_seen = 0;
268
269
- strbuf_addf(&cert, "certificate version 0.1\n");
269
+ strbuf_addstr(&cert, "certificate version 0.1\n");
270
strbuf_addf(&cert, "pusher %s ", signing_key);
271
datestamp(&cert);
272
strbuf_addch(&cert, '\n');
t/helper/test-run-command.c
+3
-3
@@ -26,7 +26,7 @@ static int parallel_next(struct child_process *cp,
26
return 0;
27
28
argv_array_pushv(&cp->args, d->argv);
29
- strbuf_addf(err, "preloaded output of a child\n");
29
+ strbuf_addstr(err, "preloaded output of a child\n");
30
number_callbacks++;
31
return 1;
32
}
@@ -36,7 +36,7 @@ static int no_job(struct child_process *cp,
36
void *cb,
37
void **task_cb)
38
{
39
- strbuf_addf(err, "no further jobs available\n");
39
+ strbuf_addstr(err, "no further jobs available\n");
40
return 0;
41
}
42
@@ -45,7 +45,7 @@ static int task_finished(int result,
45
void *pp_cb,
46
void *pp_task_cb)
47
{
48
- strbuf_addf(err, "asking for a quick stop\n");
48
+ strbuf_addstr(err, "asking for a quick stop\n");
49
return 1;
50
}
51