diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-01-12 11:38:51 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-01-12 11:38:53 -0800 |
commit | 7a353ec965df6e1b17ee52360c1369ebe2a961ec (patch) | |
tree | 0fcac5c5b9cc2ae39508ed23b7b0ebc61509911a | |
parent | acddf4943234bbddfce4e7857c9fd7f0cfc7546b (diff) | |
parent | 6b33894f9973185135a5ddd7d665c56bf5ca9a20 (diff) | |
download | git-7a353ec965df6e1b17ee52360c1369ebe2a961ec.tar.gz |
Merge branch 'rs/simplify-transport-get'
* rs/simplify-transport-get:
transport: simplify duplicating a substring in transport_get() using xmemdupz()
-rw-r--r-- | transport.c | 4 |
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); } |