summaryrefslogtreecommitdiff
path: root/builtin/config.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-08-20 14:49:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-20 20:16:50 (GMT)
commita92330d21c13cf244d8045f5c9d1df6e63893d58 (patch)
tree5498d804f7f465b9e6240059166e97ae29fa51e9 /builtin/config.c
parentf2259877531ed2a58ec04aeaeb6beb5183f81f92 (diff)
downloadgit-a92330d21c13cf244d8045f5c9d1df6e63893d58.zip
git-a92330d21c13cf244d8045f5c9d1df6e63893d58.tar.gz
git-a92330d21c13cf244d8045f5c9d1df6e63893d58.tar.bz2
get_urlmatch: avoid useless strbuf write
We create a strbuf only to insert a single string, pass the resulting buffer to a function (which does not modify the string), and then free it. We can just pass the original string instead. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/config.c')
-rw-r--r--builtin/config.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/builtin/config.c b/builtin/config.c
index 04befce..71acc44 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -425,14 +425,11 @@ static int get_urlmatch(const char *var, const char *url)
for_each_string_list_item(item, &values) {
struct urlmatch_current_candidate_value *matched = item->util;
- struct strbuf key = STRBUF_INIT;
struct strbuf buf = STRBUF_INIT;
- strbuf_addstr(&key, item->string);
- format_config(&buf, key.buf,
+ format_config(&buf, item->string,
matched->value_is_null ? NULL : matched->value.buf);
fwrite(buf.buf, 1, buf.len, stdout);
- strbuf_release(&key);
strbuf_release(&buf);
strbuf_release(&matched->value);