Skip to content

Commit 574a31b

Browse files
committed
Merge branch 'rs/use-strbuf-addstr' into maint
* rs/use-strbuf-addstr: use strbuf_addstr() instead of strbuf_addf() with "%s" use strbuf_addstr() for adding constant strings to a strbuf
2 parents 9a54075 + bc57b9c commit 574a31b

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

builtin/fmt-merge-msg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static int cmp_string_list_util_as_integral(const void *a_, const void *b_)
272272
static void add_people_count(struct strbuf *out, struct string_list *people)
273273
{
274274
if (people->nr == 1)
275-
strbuf_addf(out, "%s", people->items[0].string);
275+
strbuf_addstr(out, people->items[0].string);
276276
else if (people->nr == 2)
277277
strbuf_addf(out, "%s (%d) and %s (%d)",
278278
people->items[0].string,

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");

http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ void append_remote_object_url(struct strbuf *buf, const char *url,
11051105

11061106
strbuf_addf(buf, "objects/%.*s/", 2, hex);
11071107
if (!only_two_digit_prefix)
1108-
strbuf_addf(buf, "%s", hex+2);
1108+
strbuf_addstr(buf, hex + 2);
11091109
}
11101110

11111111
char *get_remote_object_url(const char *url, const char *hex,

send-pack.c

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

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

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static void remove_sequencer_state(void)
112112
{
113113
struct strbuf seq_dir = STRBUF_INIT;
114114

115-
strbuf_addf(&seq_dir, "%s", git_path(SEQ_DIR));
115+
strbuf_addstr(&seq_dir, git_path(SEQ_DIR));
116116
remove_dir_recursively(&seq_dir, 0);
117117
strbuf_release(&seq_dir);
118118
}

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)