threads / patch / 48139

patchrun-command: use strbuf_addstr() for adding a string to a strbuf

Subject: [PATCH] run-command: use strbuf_addstr() for adding a string to a strbuf

## tl;dr

3 messages between Mar 25, 2018 and Mar 25, 2018. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

René Scharfe· Mar 25, 2018, 10:57 UTC · lore
Patch generated with Coccinelle and contrib/coccinelle/strbuf.cocci.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
That line was added by e73dd78699 (run-command.c: introduce
trace_run_command()).
 run-command.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to run-command.c +1 −1
diff --git a/run-command.c b/run-command.c
index a483d5904a..84899e423f 100644
--- a/run-command.c
+++ b/run-command.c
@@ -621,7 +621,7 @@ static void trace_run_command(const struct child_process *cp)
 	if (!trace_want(&trace_default_key))
 		return;
 
-	strbuf_addf(&buf, "trace: run_command:");
+	strbuf_addstr(&buf, "trace: run_command:");
 	if (cp->dir) {
 		strbuf_addstr(&buf, " cd ");
 		sq_quote_buf_pretty(&buf, cp->dir);
-- 
2.16.3
Junio C Hamano· Mar 25, 2018, 16:49 UTC · re: René Scharfe · lore

Re: [PATCH] run-command: use strbuf_addstr() for adding a string to a strbuf

René Scharfe <l.s.r@web.de> writes:
Show 6 quoted lines
> Patch generated with Coccinelle and contrib/coccinelle/strbuf.cocci.
>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
> That line was added by e73dd78699 (run-command.c: introduce
> trace_run_command()).
Thanks.
Show 17 quoted lines
>
>  run-command.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/run-command.c b/run-command.c
> index a483d5904a..84899e423f 100644
> --- a/run-command.c
> +++ b/run-command.c
> @@ -621,7 +621,7 @@ static void trace_run_command(const struct child_process *cp)
>  	if (!trace_want(&trace_default_key))
>  		return;
>  
> -	strbuf_addf(&buf, "trace: run_command:");
> +	strbuf_addstr(&buf, "trace: run_command:");
>  	if (cp->dir) {
>  		strbuf_addstr(&buf, " cd ");
>  		sq_quote_buf_pretty(&buf, cp->dir);
Duy Nguyen· Mar 25, 2018, 16:49 UTC · re: René Scharfe · lore

Re: [PATCH] run-command: use strbuf_addstr() for adding a string to a strbuf

On Sun, Mar 25, 2018 at 12:57 PM, René Scharfe <l.s.r@web.de> wrote:
Show 20 quoted lines
> Patch generated with Coccinelle and contrib/coccinelle/strbuf.cocci.
>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
> That line was added by e73dd78699 (run-command.c: introduce
> trace_run_command()).
>
>  run-command.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/run-command.c b/run-command.c
> index a483d5904a..84899e423f 100644
> --- a/run-command.c
> +++ b/run-command.c
> @@ -621,7 +621,7 @@ static void trace_run_command(const struct child_process *cp)
>         if (!trace_want(&trace_default_key))
>                 return;
>
> -       strbuf_addf(&buf, "trace: run_command:");
> +       strbuf_addstr(&buf, "trace: run_command:");
Obviously correct. Ack.
Show 5 quoted lines
>         if (cp->dir) {
>                 strbuf_addstr(&buf, " cd ");
>                 sq_quote_buf_pretty(&buf, cp->dir);
> --
> 2.16.3
-- 
Duy

← back to recent threads