Thread (56 messages) 56 messages, 4 authors, 2020-07-15

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

From: Jeff King <hidden>
Date: 2020-05-14 17:56:49

On Wed, May 13, 2020 at 03:59:41PM -0600, Taylor Blau wrote:
quoted hunk ↗ jump to hunk
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help