@matheusbsbs / matheus-bagliano / commits / 32716a2c6c
Fork 0

builtin-clone: use strbuf in guess_dir_name()

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Miklos Vajna committed Nov 21, 2008 at 01:44 UTC 32716a2c6c238113c9a5af116e5ab6f3f4ecde8d
1 file changed +3 -3
builtin-clone.c
+3 -3
@@ -134,9 +134,9 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare)
134 }
135
136 if (is_bare) {
137 - char *result = xmalloc(end - start + 5);
138 - sprintf(result, "%.*s.git", (int)(end - start), start);
139 - return result;
137 + struct strbuf result = STRBUF_INIT;
138 + strbuf_addf(&result, "%.*s.git", (int)(end - start), start);
139 + return strbuf_detach(&result, 0);
140 }
141
142 return xstrndup(start, end - start);