git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Git Mailing List <git@vger.kernel.org>
Cc: Jeff Hostetler <jeffhost@microsoft.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] trace2: use warning() directly in tr2_dst_malformed_warning()
Date: Sun, 25 Aug 2019 19:44:10 +0200	[thread overview]
Message-ID: <2492824a-6aff-8b82-801a-808ee944a99e@web.de> (raw)

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>
---
 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


             reply	other threads:[~2019-08-25 17:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-25 17:44 René Scharfe [this message]
2019-09-04  9:14 ` [PATCH] trace2: use warning() directly in tr2_dst_malformed_warning() Jeff Hostetler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2492824a-6aff-8b82-801a-808ee944a99e@web.de \
    --to=l.s.r@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).