summaryrefslogtreecommitdiff
path: root/http-walker.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-06-19 21:24:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-19 22:20:54 (GMT)
commit283101869bea8feb5d58f6ea1b568e9b197526d3 (patch)
tree3aba65688e4a5a11a3d0a60d2fa60930fd398898 /http-walker.c
parent95244ae3dd49b3eed4dbfe09299b9d8847622218 (diff)
downloadgit-283101869bea8feb5d58f6ea1b568e9b197526d3.zip
git-283101869bea8feb5d58f6ea1b568e9b197526d3.tar.gz
git-283101869bea8feb5d58f6ea1b568e9b197526d3.tar.bz2
use xstrfmt to replace xmalloc + sprintf
This is one line shorter, and makes sure the length in the malloc and sprintf steps match. These conversions are very straightforward; we can drop the malloc entirely, and replace the sprintf with xstrfmt. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-walker.c')
-rw-r--r--http-walker.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/http-walker.c b/http-walker.c
index ab6a4fe..dbddfaa 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -341,8 +341,7 @@ static void fetch_alternates(struct walker *walker, const char *base)
if (walker->get_verbosely)
fprintf(stderr, "Getting alternates list for %s\n", base);
- url = xmalloc(strlen(base) + 31);
- sprintf(url, "%s/objects/info/http-alternates", base);
+ url = xstrfmt("%s/objects/info/http-alternates", base);
/*
* Use a callback to process the result, since another request