From c1e860f1dcd29495f98fc60d68f75151196335e6 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 19 Jul 2017 16:56:19 +0200 Subject: run_processes_parallel: change confusing task_cb convention By declaring the task_cb parameter of type `void **`, the signature of the get_next_task method suggests that the "task-specific cookie" can be defined in that method, and the signatures of the start_failure and of the task_finished methods declare that parameter of type `void *`, suggesting that those methods are mere users of said cookie. That convention makes a total lot of sense, because the tasks are pretty much dead when one of the latter two methods is called: there would be little use to reset that cookie at that point because nobody would be able to see the change afterwards. However, this is not what the code actually does. For all three methods, it passes the *address* of pp->children[i].data. As reasoned above, this behavior makes no sense. So let's change the implementation to adhere to the convention suggested by the signatures. Signed-off-by: Johannes Schindelin Acked-by: Stefan Beller Signed-off-by: Junio C Hamano --- run-command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'run-command.c') diff --git a/run-command.c b/run-command.c index 5a4dbb66d..038d0e837 100644 --- a/run-command.c +++ b/run-command.c @@ -1184,7 +1184,7 @@ static int pp_start_one(struct parallel_processes *pp) if (start_command(&pp->children[i].process)) { code = pp->start_failure(&pp->children[i].err, pp->data, - &pp->children[i].data); + pp->children[i].data); strbuf_addbuf(&pp->buffered_output, &pp->children[i].err); strbuf_reset(&pp->children[i].err); if (code) @@ -1252,7 +1252,7 @@ static int pp_collect_finished(struct parallel_processes *pp) code = pp->task_finished(code, &pp->children[i].err, pp->data, - &pp->children[i].data); + pp->children[i].data); if (code) result = code; -- cgit v1.2.1