Skip to content

Commit 1fd881d

Browse files
rscharfegitster
authored andcommitted
trace2: use warning() directly in tr2_dst_malformed_warning()
Let warning() format the message instead of using an intermediate strbuf for that. This is shorter, easier to read and avoids an allocation. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bce9db6 commit 1fd881d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

trace2/tr2_dst.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,8 @@ static int tr2_dst_try_unix_domain_socket(struct tr2_dst *dst,
166166
static void tr2_dst_malformed_warning(struct tr2_dst *dst,
167167
const char *tgt_value)
168168
{
169-
struct strbuf buf = STRBUF_INIT;
170-
171-
strbuf_addf(&buf, "trace2: unknown value for '%s': '%s'",
172-
tr2_sysenv_display_name(dst->sysenv_var), tgt_value);
173-
warning("%s", buf.buf);
174-
175-
strbuf_release(&buf);
169+
warning("trace2: unknown value for '%s': '%s'",
170+
tr2_sysenv_display_name(dst->sysenv_var), tgt_value);
176171
}
177172

178173
int tr2_dst_get_trace_fd(struct tr2_dst *dst)

0 commit comments

Comments
 (0)