Skip to content

Commit

Permalink
builtin-clone: use strbuf in guess_dir_name()
Browse files Browse the repository at this point in the history
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Miklos Vajna authored and Junio C Hamano committed Nov 25, 2008
1 parent 6fc4a7e commit 32716a2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions builtin-clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 32716a2

Please sign in to comment.