trace2: use warning() directly in tr2_dst_malformed_warning()
authorRené Scharfe <l.s.r@web.de>
Sun, 25 Aug 2019 17:44:10 +0000 (19:44 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Aug 2019 18:34:23 +0000 (11:34 -0700)
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>
trace2/tr2_dst.c
index 7d96f33420b389a10a6256f6d95a46a76f1765f3..6c425f17f3ca7a75c9b3a0c26dba50582672757a 100644 (file)
@@ -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)