[PATCH] trace2: use warning() directly in tr2_dst_malformed_warning()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 trace2/tr2_dst.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/trace2/tr2_dst.c b/trace2/tr2_dst.c
index 5dda0ca1cd..c69857515f 100644
--- a/trace2/tr2_dst.c
+++ b/trace2/tr2_dst.c
@@ -215,13 +215,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)
--
2.23.0





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux