diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2006-12-30 21:55:15 -0500 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-12-30 22:22:14 -0800 |
commit | 9b0b50936ec76ad8e582d18d5bf54bc81c685e9b (patch) | |
tree | 1599e84bb2e53adbce3728f62d1c3c38d815a1e9 /run-command.c | |
parent | ad1a382fbb3ecb1bb017854a470816c815cc46c9 (diff) | |
download | git-9b0b50936ec76ad8e582d18d5bf54bc81c685e9b.tar.gz |
Remove unnecessary argc parameter from run_command_v.
The argc parameter is never used by the run_command_v family of
functions. Instead they require that the passed argv[] be NULL
terminated so they can rely on the operating system's execvp
function to correctly pass the arguments to the new process.
Making the caller pass the argc is just confusing, as the caller
could be mislead into believing that the argc might take precendece
over the argv, or that the argv does not need to be NULL terminated.
So goodbye argc. Don't come back.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'run-command.c')
-rw-r--r-- | run-command.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/run-command.c b/run-command.c index 492ad3e64c..d0330c3793 100644 --- a/run-command.c +++ b/run-command.c @@ -2,7 +2,7 @@ #include "run-command.h" #include "exec_cmd.h" -int run_command_v_opt(int argc, const char **argv, int flags) +int run_command_v_opt(const char **argv, int flags) { pid_t pid = fork(); @@ -46,9 +46,9 @@ int run_command_v_opt(int argc, const char **argv, int flags) } } -int run_command_v(int argc, const char **argv) +int run_command_v(const char **argv) { - return run_command_v_opt(argc, argv, 0); + return run_command_v_opt(argv, 0); } int run_command(const char *cmd, ...) @@ -69,5 +69,5 @@ int run_command(const char *cmd, ...) va_end(param); if (MAX_RUN_COMMAND_ARGS <= argc) return error("too many args to run %s", cmd); - return run_command_v_opt(argc, argv, 0); + return run_command_v_opt(argv, 0); } |