Commit 33011e76 authored by Duy Nguyen's avatar Duy Nguyen Committed by Junio C Hamano

trace.c: move strbuf_release() out of print_trace_line()

The function is about printing a trace line, not releasing the buffer it
receives too. Move strbuf_release() back outside. This makes it easier
to see how strbuf is managed.
Signed-off-by: Duy Nguyen's avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 1fbdab21
......@@ -131,7 +131,6 @@ static void print_trace_line(struct trace_key *key, struct strbuf *buf)
{
strbuf_complete_line(buf);
trace_write(key, buf->buf, buf->len);
strbuf_release(buf);
}
static void trace_vprintf_fl(const char *file, int line, struct trace_key *key,
......@@ -144,6 +143,7 @@ static void trace_vprintf_fl(const char *file, int line, struct trace_key *key,
strbuf_vaddf(&buf, format, ap);
print_trace_line(key, &buf);
strbuf_release(&buf);
}
static void trace_argv_vprintf_fl(const char *file, int line,
......@@ -159,6 +159,7 @@ static void trace_argv_vprintf_fl(const char *file, int line,
sq_quote_argv_pretty(&buf, argv);
print_trace_line(&trace_default_key, &buf);
strbuf_release(&buf);
}
void trace_strbuf_fl(const char *file, int line, struct trace_key *key,
......@@ -171,6 +172,7 @@ void trace_strbuf_fl(const char *file, int line, struct trace_key *key,
strbuf_addbuf(&buf, data);
print_trace_line(key, &buf);
strbuf_release(&buf);
}
static void trace_performance_vprintf_fl(const char *file, int line,
......@@ -190,6 +192,7 @@ static void trace_performance_vprintf_fl(const char *file, int line,
}
print_trace_line(&trace_perf_key, &buf);
strbuf_release(&buf);
}
#ifndef HAVE_VARIADIC_MACROS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment