From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Sun, 7 Apr 2013 10:30:00 +0100 Subject: [PATCH 09/19] ui-plain.c: use struct strbuf instead of fmt() In-Reply-To: References: Message-ID: Signed-off-by: John Keeping --- ui-plain.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui-plain.c b/ui-plain.c index 4c6cbb7..9793804 100644 --- a/ui-plain.c +++ b/ui-plain.c @@ -107,10 +107,12 @@ static int print_object(const unsigned char *sha1, const char *path) static char *buildpath(const char *base, int baselen, const char *path) { + struct strbuf buf = STRBUF_INIT; if (path[0]) - return fmt("%.*s%s/", baselen, base, path); + strbuf_addf(&buf, "%.*s%s/", baselen, base, path); else - return fmt("%.*s/", baselen, base); + strbuf_addf(&buf, "%.*s/", baselen, base); + return strbuf_detach(&buf, NULL); } static void print_dir(const unsigned char *sha1, const char *base, @@ -141,6 +143,7 @@ static void print_dir(const unsigned char *sha1, const char *base, fullpath); html("\n"); } + free(fullpath); } static void print_dir_entry(const unsigned char *sha1, const char *base, @@ -158,6 +161,7 @@ static void print_dir_entry(const unsigned char *sha1, const char *base, cgit_plain_link(path, NULL, NULL, ctx.qry.head, ctx.qry.sha1, fullpath); html("\n"); + free(fullpath); } static void print_dir_tail(void) -- 1.8.2.692.g17a9715