summaryrefslogtreecommitdiff
path: root/http-walker.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-06-19 21:19:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-19 22:20:53 (GMT)
commit95244ae3dd49b3eed4dbfe09299b9d8847622218 (patch)
treeb70932b2e4e8205c2f6f6b0cfcb88ca172c2d9d9 /http-walker.c
parentfa3f60b783b42e0d07c667a8f582c3df12791cec (diff)
downloadgit-95244ae3dd49b3eed4dbfe09299b9d8847622218.zip
git-95244ae3dd49b3eed4dbfe09299b9d8847622218.tar.gz
git-95244ae3dd49b3eed4dbfe09299b9d8847622218.tar.bz2
use xstrdup instead of xmalloc + strcpy
This is one line shorter, and makes sure the length in the malloc and copy steps match. 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 1516c5e..ab6a4fe 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -566,8 +566,7 @@ struct walker *get_http_walker(const char *url)
struct walker *walker = xmalloc(sizeof(struct walker));
data->alt = xmalloc(sizeof(*data->alt));
- data->alt->base = xmalloc(strlen(url) + 1);
- strcpy(data->alt->base, url);
+ data->alt->base = xstrdup(url);
for (s = data->alt->base + strlen(data->alt->base) - 1; *s == '/'; --s)
*s = 0;