Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-10-13 00:02:32 +0300
committerJunio C Hamano <gitster@pobox.com>2022-10-13 00:12:42 +0300
commit9f3df6c0487bde80626ea2f367f9850e1758720b (patch)
tree6e1ed8927c2fa2d890397be802b110dcb48d479c /run-command.c
parent2aa8d2259ffd477b5d8ff090c90b7d38910b4741 (diff)
run-command.c: use "opts->processes", not "pp->max_processes"
Neither the "processes" nor "max_processes" members ever change after their initialization, and they're always equivalent, but some existing code used "pp->max_processes" when we were already passing the "opts" to the function, let's use the "opts" directly instead. 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.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/run-command.c b/run-command.c
index d382c42f82..719a5b58e2 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1599,10 +1599,10 @@ static int pp_start_one(struct parallel_processes *pp,
size_t i;
int code;
- for (i = 0; i < pp->max_processes; i++)
+ for (i = 0; i < opts->processes; i++)
if (pp->children[i].state == GIT_CP_FREE)
break;
- if (i == pp->max_processes)
+ if (i == opts->processes)
BUG("bookkeeping is hard");
code = opts->get_next_task(&pp->children[i].process,
@@ -1689,14 +1689,14 @@ static int pp_collect_finished(struct parallel_processes *pp,
const struct run_process_parallel_opts *opts)
{
int code;
- size_t i, n = pp->max_processes;
+ size_t i;
int result = 0;
while (pp->nr_processes > 0) {
- for (i = 0; i < pp->max_processes; i++)
+ for (i = 0; i < opts->processes; i++)
if (pp->children[i].state == GIT_CP_WAIT_CLEANUP)
break;
- if (i == pp->max_processes)
+ if (i == opts->processes)
break;
code = finish_command(&pp->children[i].process);
@@ -1725,6 +1725,8 @@ static int pp_collect_finished(struct parallel_processes *pp,
strbuf_addbuf(&pp->buffered_output, &pp->children[i].err);
strbuf_reset(&pp->children[i].err);
} else {
+ const size_t n = opts->processes;
+
strbuf_write(&pp->children[i].err, stderr);
strbuf_reset(&pp->children[i].err);
@@ -1771,7 +1773,7 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts)
while (1) {
for (i = 0;
i < spawn_cap && !pp.shutdown &&
- pp.nr_processes < pp.max_processes;
+ pp.nr_processes < opts->processes;
i++) {
code = pp_start_one(&pp, opts);
if (!code)
@@ -1785,7 +1787,7 @@ void run_processes_parallel(const struct run_process_parallel_opts *opts)
if (!pp.nr_processes)
break;
if (opts->ungroup) {
- for (size_t i = 0; i < pp.max_processes; i++)
+ for (size_t i = 0; i < opts->processes; i++)
pp.children[i].state = GIT_CP_WAIT_CLEANUP;
} else {
pp_buffer_stderr(&pp, output_timeout);