Skip to content

Commit

Permalink
trace2: use warning() directly in tr2_dst_malformed_warning()
Browse files Browse the repository at this point in the history
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 <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
rscharfe authored and gitster committed Aug 26, 2019
1 parent bce9db6 commit 1fd881d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions trace2/tr2_dst.c
Expand Up @@ -166,13 +166,8 @@ static int tr2_dst_try_unix_domain_socket(struct tr2_dst *dst,
static void tr2_dst_malformed_warning(struct tr2_dst *dst,
const char *tgt_value)
{
struct strbuf buf = STRBUF_INIT;

strbuf_addf(&buf, "trace2: unknown value for '%s': '%s'",
tr2_sysenv_display_name(dst->sysenv_var), tgt_value);
warning("%s", buf.buf);

strbuf_release(&buf);
warning("trace2: unknown value for '%s': '%s'",
tr2_sysenv_display_name(dst->sysenv_var), tgt_value);
}

int tr2_dst_get_trace_fd(struct tr2_dst *dst)
Expand Down

0 comments on commit 1fd881d

Please sign in to comment.