{"thread":{"id":"8563","subject":"Passing **envp around in git.c","startedAt":"2007-06-11T21:15:48Z","lastAt":"2007-06-11T21:15:48Z","messageCount":1,"participants":["Stephen Cuppett"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"44758","messageId":"316a20a40706111415i3181df45oabd1564313eea3bc@mail.gmail.com","threadId":"8563","inReplyTo":null,"subject":"Passing **envp around in git.c","fromName":"Stephen Cuppett","fromEmail":"cuppett@gmail.com","sentAt":"2007-06-11T21:15:48Z","receivedAt":"2007-06-11T21:15:48Z","isPatch":false,"sender":{"key":"cuppett@gmail.com","avatar":null},"body":"Is there a reason for passing char** envp around in git.c or is it a\nvestige of something older?  It's sent into handle_internal_command\nfrom main; however, it's never used.  Looks like it might have been\nused before, but then replaced with getenv.  The code probably gets\noptimized out at compile time, but to clean up:\n\ndiff --git a/git.c b/git.c\nindex 29b55a1..614baed 100644\n--- a/git.c\n+++ b/git.c\n@@ -216,7 +216,7 @@ const char git_version_string[] = GIT_VERSION;\n  */\n #define NOT_BARE       (1<<2)\n\n-static void handle_internal_command(int argc, const char **argv, char **envp)\n+static void handle_internal_command(int argc, const char **argv)\n {\n        const char *cmd = argv[0];\n        static struct cmd_struct {\n@@ -358,7 +358,7 @@ int main(int argc, const char **argv, char **envp)\n        if (!prefixcmp(cmd, \"git-\")) {\n                cmd += 4;\n                argv[0] = cmd;\n-               handle_internal_command(argc, argv, envp);\n+               handle_internal_command(argc, argv);\n                die(\"cannot handle %s internally\", cmd);\n        }\n\n@@ -390,7 +390,7 @@ int main(int argc, const char **argv, char **envp)\n\n        while (1) {\n                /* See if it's an internal command */\n-               handle_internal_command(argc, argv, envp);\n+               handle_internal_command(argc, argv);\n\n                /* .. then try the external ones */\n                execv_git_cmd(argv);\n"}]}