Re: [PATCH v3 4/8] builtin/commit-graph.c: extract 'read_one_commit()'

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

 



On Wed, May 13, 2020 at 03:59:41PM -0600, Taylor Blau wrote:

> @@ -209,44 +220,35 @@ static int graph_write(int argc, const char **argv)
>  		return 0;
>  	}
>  
> -	string_list_init(&lines, 0);
> -	if (opts.stdin_packs || opts.stdin_commits) {
> -		struct strbuf buf = STRBUF_INIT;
> +	struct strbuf buf = STRBUF_INIT;
> +	if (opts.stdin_packs) {

This is a decl-after-statement, isn't it? It should fail with
DEVELOPER=1.

The strbuf could be local in each block of the conditional, though that
makes your cleanup label trickier. Only the stdin_commits side needs to
clean up the buf, so we could just do it there. Or I'd be OK with having
the strbuf declared at the top of the function, and using the
whole-function cleanup label.

-Peff



[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