summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2014-12-24 01:18:31 +0100
committerJunio C Hamano <gitster@pobox.com>2014-12-29 09:39:23 -0800
commit6b33894f9973185135a5ddd7d665c56bf5ca9a20 (patch)
tree4aac8027554482b021a1c85b1743f245c56a4b9c
parentc2e8e4b9da4d007b15faa2e3d407b2fd279f0572 (diff)
downloadgit-6b33894f9973185135a5ddd7d665c56bf5ca9a20.tar.gz
transport: simplify duplicating a substring in transport_get() using xmemdupz()rs/simplify-transport-get
Signed-off-by: Rene Scharfe <l.s.r@web.de> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--transport.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/transport.c b/transport.c
index 70d38e4c4b..08bcd3a4eb 100644
--- a/transport.c
+++ b/transport.c
@@ -971,9 +971,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
} else {
/* Unknown protocol in URL. Pass to external handler. */
int len = external_specification_len(url);
- char *handler = xmalloc(len + 1);
- handler[len] = 0;
- strncpy(handler, url, len);
+ char *handler = xmemdupz(url, len);
transport_helper_init(ret, handler);
}