summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad1a382)
raw | patch | inline | side by side (parent: ad1a382)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 31 Dec 2006 02:55:15 +0000 (21:55 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 31 Dec 2006 06:22:14 +0000 (22:22 -0800) |
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>
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>
builtin-push.c | patch | blob | history | |
receive-pack.c | patch | blob | history | |
run-command.c | patch | blob | history | |
run-command.h | patch | blob | history |
diff --git a/builtin-push.c b/builtin-push.c
index b7412e82937a240776cdda07da05797b0b2acb0b..7a3d2bb06416219a41cf6a0757cf3d03a56ef0da 100644 (file)
--- a/builtin-push.c
+++ b/builtin-push.c
argv[dest_argc] = NULL;
if (verbose)
fprintf(stderr, "Pushing to %s\n", dest);
- err = run_command_v(argc, argv);
+ err = run_command_v(argv);
if (!err)
continue;
switch (err) {
diff --git a/receive-pack.c b/receive-pack.c
index 59b682c03af53fbfe600d063fa832f874440493c..2b0ba638af7340075c1304d21042688e77ae9874 100644 (file)
--- a/receive-pack.c
+++ b/receive-pack.c
argc++;
}
argv[argc] = NULL;
- run_command_v_opt(argc, argv, RUN_COMMAND_NO_STDIO);
+ run_command_v_opt(argv, RUN_COMMAND_NO_STDIO);
}
/*
unpacker[0] = "unpack-objects";
unpacker[1] = hdr_arg;
unpacker[2] = NULL;
- code = run_command_v_opt(1, unpacker, RUN_GIT_CMD);
+ code = run_command_v_opt(unpacker, RUN_GIT_CMD);
switch (code) {
case 0:
return NULL;
diff --git a/run-command.c b/run-command.c
index 492ad3e64ce5d2435c029ab032f1221347f37c19..d0330c3793ca86ab68ae64932e5539aa25020e82 100644 (file)
--- a/run-command.c
+++ b/run-command.c
#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();
}
}
-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, ...)
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);
}
diff --git a/run-command.h b/run-command.h
index 70b477a7483ce3a4997b20ee02223eeb483bde6c..82a0861f232900c557b068bb9962fb94e246859d 100644 (file)
--- a/run-command.h
+++ b/run-command.h
#define RUN_COMMAND_NO_STDIO 1
#define RUN_GIT_CMD 2 /*If this is to be git sub-command */
-int run_command_v_opt(int argc, const char **argv, int opt);
-int run_command_v(int argc, const char **argv);
+int run_command_v_opt(const char **argv, int opt);
+int run_command_v(const char **argv);
int run_command(const char *cmd, ...);
#endif