diff options
author | René Scharfe <l.s.r@web.de> | 2022-10-30 14:51:14 +0300 |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2022-10-30 21:04:40 +0300 |
commit | 0e90673957f12adc1a84b13d3dfff02151e4a7a8 (patch) | |
tree | 737050f737be02089d750d4a291cc65421afc89b /scalar.c | |
parent | 4120294cbf8e434c1de408434842d570eba0e25d (diff) |
use child_process members "args" and "env" directly
Build argument list and environment of child processes by using
struct child_process and populating its members "args" and "env"
directly instead of maintaining separate strvecs and letting
run_command_v_opt() and friends populate these members. This is
simpler, shorter and slightly more efficient.
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'scalar.c')
-rw-r--r-- | scalar.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -69,21 +69,18 @@ static void setup_enlistment_directory(int argc, const char **argv, static int run_git(const char *arg, ...) { - struct strvec argv = STRVEC_INIT; + struct child_process cmd = CHILD_PROCESS_INIT; va_list args; const char *p; - int res; va_start(args, arg); - strvec_push(&argv, arg); + strvec_push(&cmd.args, arg); while ((p = va_arg(args, const char *))) - strvec_push(&argv, p); + strvec_push(&cmd.args, p); va_end(args); - res = run_command_v_opt(argv.v, RUN_GIT_CMD); - - strvec_clear(&argv); - return res; + cmd.git_cmd = 1; + return run_command(&cmd); } struct scalar_config { |