git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Sep 4, 2019, 09:14 UTC
Message-ID
<04604b38-73c1-23e2-77a0-cb716beb507e@jeffhostetler.com>
In-Reply-To
<2492824a-6aff-8b82-801a-808ee944a99e@web.de>
On 8/25/2019 1:44 PM, René Scharfe wrote:
Show 31 quoted lines
> 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
> 
good catch!  thanks!
Jeff
Previous: René Scharfe
Message 2 of 2 in “trace2: use warning() directly in tr2_dst_malformed_warning()”
  1. trace2: use warning() directly in tr2_dst_malformed_warning()René Scharfe, Aug 25, 2019
  2. Jeff HostetlerSep 4, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.