mirror of
https://github.com/git/git.git
synced 2024-11-18 23:13:58 +01:00
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: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
1fbdab21bb
commit
33011e769c
5
trace.c
5
trace.c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user