Passing **envp around in git.c
- From
- Stephen Cuppett <cuppett@gmail.com>
- Date
- Jun 11, 2007, 21:15 UTC
- Message-ID
- <316a20a40706111415i3181df45oabd1564313eea3bc@mail.gmail.com>
Is there a reason for passing char** envp around in git.c or is it a vestige of something older? It's sent into handle_internal_command from main; however, it's never used. Looks like it might have been used before, but then replaced with getenv. The code probably gets optimized out at compile time, but to clean up:
diff --git a/git.c b/git.c index 29b55a1..614baed 100644 --- a/git.c +++ b/git.c @@ -216,7 +216,7 @@ const char git_version_string[] = GIT_VERSION; */ #define NOT_BARE (1<<2) -static void handle_internal_command(int argc, const char **argv, char **envp) +static void handle_internal_command(int argc, const char **argv) { const char *cmd = argv[0]; static struct cmd_struct { @@ -358,7 +358,7 @@ int main(int argc, const char **argv, char **envp) if (!prefixcmp(cmd, "git-")) { cmd += 4; argv[0] = cmd; - handle_internal_command(argc, argv, envp); + handle_internal_command(argc, argv); die("cannot handle %s internally", cmd); } @@ -390,7 +390,7 @@ int main(int argc, const char **argv, char **envp) while (1) { /* See if it's an internal command */ - handle_internal_command(argc, argv, envp); + handle_internal_command(argc, argv); /* .. then try the external ones */ execv_git_cmd(argv);