Skip to content

Commit

Permalink
transport: simplify duplicating a substring in transport_get() using …
Browse files Browse the repository at this point in the history
…xmemdupz()

Signed-off-by: Rene Scharfe <[email protected]>
Reviewed-by: Jonathan Nieder <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
rscharfe authored and gitster committed Dec 29, 2014
1 parent c2e8e4b commit 6b33894
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 6b33894

Please sign in to comment.