Code

Turn builtin_exec_path into a function.
authorJohannes Sixt <johannes.sixt@telecom.at>
Wed, 11 Apr 2007 13:26:08 +0000 (15:26 +0200)
committerJohannes Sixt <johannes.sixt@telecom.at>
Thu, 26 Jun 2008 06:45:12 +0000 (08:45 +0200)
builtin_exec_path returns the hard-coded installation path, which is used
as the ultimate fallback to look for git commands. Making it into a function
enables us in a follow-up patch to return a computed value instead of just
a constant string.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
exec_cmd.c

index a1bc4e04bf055709bf6fab3133e0a1832c56adee..6618aad7abde8b0e74186ce7742acf0e22925479 100644 (file)
@@ -4,9 +4,13 @@
 #define MAX_ARGS       32
 
 extern char **environ;
-static const char *builtin_exec_path = GIT_EXEC_PATH;
 static const char *argv_exec_path;
 
+static const char *builtin_exec_path(void)
+{
+       return GIT_EXEC_PATH;
+}
+
 void git_set_argv_exec_path(const char *exec_path)
 {
        argv_exec_path = exec_path;
@@ -26,7 +30,7 @@ const char *git_exec_path(void)
                return env;
        }
 
-       return builtin_exec_path;
+       return builtin_exec_path();
 }
 
 static void add_path(struct strbuf *out, const char *path)
@@ -50,7 +54,7 @@ void setup_path(const char *cmd_path)
 
        add_path(&new_path, argv_exec_path);
        add_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));
-       add_path(&new_path, builtin_exec_path);
+       add_path(&new_path, builtin_exec_path());
        add_path(&new_path, cmd_path);
 
        if (old_path)