summaryrefslogtreecommitdiff
path: root/trace.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-01-15 10:59:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-16 20:16:54 (GMT)
commit33011e769c2dd3eaa63e5b480e5845c5d370ab13 (patch)
tree16d5565f7e5482b35158560714ec0cffcd49de10 /trace.c
parent1fbdab21bb452ca4732bf088539247047465b99d (diff)
downloadgit-33011e769c2dd3eaa63e5b480e5845c5d370ab13.zip
git-33011e769c2dd3eaa63e5b480e5845c5d370ab13.tar.gz
git-33011e769c2dd3eaa63e5b480e5845c5d370ab13.tar.bz2
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>
Diffstat (limited to 'trace.c')
-rw-r--r--trace.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/trace.c b/trace.c
index 9784915..7f3b08e 100644
--- a/trace.c
+++ b/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