Turn builtin_exec_path into a function.
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>
Johannes Sixt committed
Apr 11, 2007 at 15:26 UTC
4ec22a48c0575c8a303cd00b5ef4b3d703fbf8b3
1 file changed
+7
-3
exec_cmd.c
+7
-3
@@ -4,9 +4,13 @@
4
#define MAX_ARGS 32
5
6
extern char **environ;
7
-static const char *builtin_exec_path = GIT_EXEC_PATH;
7
static const char *argv_exec_path;
8
9
+static const char *builtin_exec_path(void)
10
+{
11
+ return GIT_EXEC_PATH;
12
+}
13
+
14
void git_set_argv_exec_path(const char *exec_path)
15
{
16
argv_exec_path = exec_path;
@@ -26,7 +30,7 @@ const char *git_exec_path(void)
30
return env;
31
}
32
29
- return builtin_exec_path;
33
+ return builtin_exec_path();
34
}
35
36
static void add_path(struct strbuf *out, const char *path)
@@ -50,7 +54,7 @@ void setup_path(const char *cmd_path)
54
55
add_path(&new_path, argv_exec_path);
56
add_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));
53
- add_path(&new_path, builtin_exec_path);
57
+ add_path(&new_path, builtin_exec_path());
58
add_path(&new_path, cmd_path);
59
60
if (old_path)