From: Miklos Vajna Date: Fri, 21 Nov 2008 00:44:59 +0000 (+0100) Subject: builtin-clone: use strbuf in guess_dir_name() X-Git-Tag: v1.6.1-rc1~11^2~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=32716a2c6c238113c9a5af116e5ab6f3f4ecde8d;p=git.git builtin-clone: use strbuf in guess_dir_name() Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- diff --git a/builtin-clone.c b/builtin-clone.c index 8e1a1d399..275b690b3 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -134,9 +134,9 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare) } if (is_bare) { - char *result = xmalloc(end - start + 5); - sprintf(result, "%.*s.git", (int)(end - start), start); - return result; + struct strbuf result = STRBUF_INIT; + strbuf_addf(&result, "%.*s.git", (int)(end - start), start); + return strbuf_detach(&result, 0); } return xstrndup(start, end - start);