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>
Nguyễn Thái Ngọc Duy committed
Jan 15, 2018 at 17:59 UTC
33011e769c2dd3eaa63e5b480e5845c5d370ab13
1 file changed
+4
-1
trace.c
+4
-1
@@ -131,7 +131,6 @@ static void print_trace_line(struct trace_key *key, struct strbuf *buf)
131
{
132
strbuf_complete_line(buf);
133
trace_write(key, buf->buf, buf->len);
134
- strbuf_release(buf);
134
}
135
136
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,
143
144
strbuf_vaddf(&buf, format, ap);
145
print_trace_line(key, &buf);
146
+ strbuf_release(&buf);
147
}
148
149
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,
159
160
sq_quote_argv_pretty(&buf, argv);
161
print_trace_line(&trace_default_key, &buf);
162
+ strbuf_release(&buf);
163
}
164
165
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,
172
173
strbuf_addbuf(&buf, data);
174
print_trace_line(key, &buf);
175
+ strbuf_release(&buf);
176
}
177
178
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,
192
}
193
194
print_trace_line(&trace_perf_key, &buf);
195
+ strbuf_release(&buf);
196
}
197
198
#ifndef HAVE_VARIADIC_MACROS