aboutsummaryrefslogtreecommitdiffstats
path: root/run-command.h
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-10-12 23:02:25 +0200
committerJunio C Hamano <gitster@pobox.com>2022-10-12 14:12:41 -0700
commitc333e6f3a86140c39797f8dedf6d078aec453dc3 (patch)
tree5ea98c00d61744fe641e7fb4146df5a07d847f35 /run-command.h
parent51243f9f0f6a932ea579fd6f8014b348f8c2a523 (diff)
downloadgit-c333e6f3a86140c39797f8dedf6d078aec453dc3.tar.gz
run-command.c: use designated init for pp_init(), add "const"
Use a designated initializer to initialize those parts of pp_init() that don't need any conditionals for their initialization, this sets us on a path to pp_init() itself into mostly a validation and allocation function. Since we're doing that we can add "const" to some of the members of the "struct parallel_processes", which helps to clarify and self-document this code. E.g. we never alter the "data" pointer we pass t user callbacks, nor (after the preceding change to stop invoking online_cpus()) do we change "max_processes", the same goes for the "ungroup" option. We can also do away with a call to strbuf_init() in favor of macro initialization, and to rely on other fields being NULL'd or zero'd. Making members of a struct "const" rather that the pointer to the struct itself is usually painful, as e.g. it precludes us from incrementally setting up the structure. In this case we only set it up with the assignment in run_process_parallel() and pp_init(), and don't pass the struct pointer around as "const", so making individual members "const" is worth the potential hassle for extra safety. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.h')
0 files changed, 0 insertions, 0 deletions