Skip to content

Commit 02962d3

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 08df31e commit 02962d3

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

builtin/rev-parse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
469469
(stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0) |
470470
PARSE_OPT_SHELL_EVAL);
471471

472-
strbuf_addf(&parsed, " --");
472+
strbuf_addstr(&parsed, " --");
473473
sq_quote_argv(&parsed, argv, 0);
474474
puts(parsed.buf);
475475
return 0;

http-push.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ static void remote_ls(const char *path, int flags,
11371137
ls.userData = userData;
11381138
ls.userFunc = userFunc;
11391139

1140-
strbuf_addf(&out_buffer.buf, PROPFIND_ALL_REQUEST);
1140+
strbuf_addstr(&out_buffer.buf, PROPFIND_ALL_REQUEST);
11411141

11421142
dav_headers = curl_slist_append(dav_headers, "Depth: 1");
11431143
dav_headers = curl_slist_append(dav_headers, "Content-Type: text/xml");

send-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static int generate_push_cert(struct strbuf *req_buf,
266266
struct strbuf cert = STRBUF_INIT;
267267
int update_seen = 0;
268268

269-
strbuf_addf(&cert, "certificate version 0.1\n");
269+
strbuf_addstr(&cert, "certificate version 0.1\n");
270270
strbuf_addf(&cert, "pusher %s ", signing_key);
271271
datestamp(&cert);
272272
strbuf_addch(&cert, '\n');

t/helper/test-run-command.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static int parallel_next(struct child_process *cp,
2626
return 0;
2727

2828
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");
3030
number_callbacks++;
3131
return 1;
3232
}
@@ -36,7 +36,7 @@ static int no_job(struct child_process *cp,
3636
void *cb,
3737
void **task_cb)
3838
{
39-
strbuf_addf(err, "no further jobs available\n");
39+
strbuf_addstr(err, "no further jobs available\n");
4040
return 0;
4141
}
4242

@@ -45,7 +45,7 @@ static int task_finished(int result,
4545
void *pp_cb,
4646
void *pp_task_cb)
4747
{
48-
strbuf_addf(err, "asking for a quick stop\n");
48+
strbuf_addstr(err, "asking for a quick stop\n");
4949
return 1;
5050
}
5151

0 commit comments

Comments
 (0)