diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-10-12 23:02:31 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-10-12 23:12:42 +0200 |
commit | 2aa8d2259ffd477b5d8ff090c90b7d38910b4741 (patch) | |
tree | 4ebb8b9ef32af8637e8a683572983417af910f21 /run-command.c | |
parent | run-command.c: don't copy "ungroup" to "struct parallel_processes" (diff) | |
download | git-2aa8d2259ffd477b5d8ff090c90b7d38910b4741.tar.xz git-2aa8d2259ffd477b5d8ff090c90b7d38910b4741.zip |
run-command.c: don't copy "data" to "struct parallel_processes"
As with the *_fn members removed in a preceding commit, let's not copy
the "data" member of the "struct run_process_parallel_opts" over to
the "struct parallel_processes". Now that we're passing the "opts"
down there's no reason to do so.
This makes the code easier to follow, as we have a "const" attribute
on the "struct run_process_parallel_opts", but not "struct
parallel_processes". We do not alter the "ungroup" argument, so
storing it in the non-const structure would make this control flow
less obvious.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r-- | run-command.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/run-command.c b/run-command.c index 19d5cff8c6..d382c42f82 100644 --- a/run-command.c +++ b/run-command.c @@ -1497,8 +1497,6 @@ enum child_state { }; struct parallel_processes { - void *const data; - const size_t max_processes; size_t nr_processes; @@ -1609,7 +1607,7 @@ static int pp_start_one(struct parallel_processes *pp, code = opts->get_next_task(&pp->children[i].process, opts->ungroup ? NULL : &pp->children[i].err, - pp->data, + opts->data, &pp->children[i].data); if (!code) { if (!opts->ungroup) { @@ -1628,7 +1626,7 @@ static int pp_start_one(struct parallel_processes *pp, if (opts->start_failure) code = opts->start_failure(opts->ungroup ? NULL : &pp->children[i].err, - pp->data, + opts->data, pp->children[i].data); else code = 0; @@ -1705,7 +1703,7 @@ static int pp_collect_finished(struct parallel_processes *pp, if (opts->task_finished) code = opts->task_finished(code, opts->ungroup ? NULL : - &pp->children[i].err, pp->data, + &pp->children[i].err, opts->data, pp->children[i].data); else code = 0; @@ -1758,7 +1756,6 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts) int spawn_cap = 4; struct parallel_processes pp = { .max_processes = opts->processes, - .data = opts->data, .buffered_output = STRBUF_INIT, }; /* options */ |