From 283101869bea8feb5d58f6ea1b568e9b197526d3 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 19 Jun 2014 17:24:33 -0400 Subject: 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 Signed-off-by: Junio C Hamano --- http-walker.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'http-walker.c') diff --git a/http-walker.c b/http-walker.c index ab6a4febeb..dbddfaa177 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 -- cgit v1.2.1