]> git.ipfire.org Git - thirdparty/git.git/blobdiff - exec_cmd.c
git_extract_argv0_path: do nothing without RUNTIME_PREFIX
[thirdparty/git.git] / exec_cmd.c
index 61092e971511ea02ce542183a50b08b17e34f2ec..ce192a2d64c846e9d7ccffe10c9476f9c5abb8b8 100644 (file)
@@ -5,9 +5,9 @@
 #define MAX_ARGS       32
 
 static const char *argv_exec_path;
-static const char *argv0_path;
 
 #ifdef RUNTIME_PREFIX
+static const char *argv0_path;
 
 static const char *system_prefix(void)
 {
@@ -27,6 +27,20 @@ static const char *system_prefix(void)
        }
        return prefix;
 }
+
+void git_extract_argv0_path(const char *argv0)
+{
+       const char *slash;
+
+       if (!argv0 || !*argv0)
+               return;
+
+       slash = find_last_dir_sep(argv0);
+
+       if (slash)
+               argv0_path = xstrndup(argv0, slash - argv0);
+}
+
 #else
 
 static const char *system_prefix(void)
@@ -34,6 +48,10 @@ static const char *system_prefix(void)
        return PREFIX;
 }
 
+void git_extract_argv0_path(const char *argv0)
+{
+}
+
 #endif /* RUNTIME_PREFIX */
 
 char *system_path(const char *path)
@@ -47,19 +65,6 @@ char *system_path(const char *path)
        return strbuf_detach(&d, NULL);
 }
 
-void git_extract_argv0_path(const char *argv0)
-{
-       const char *slash;
-
-       if (!argv0 || !*argv0)
-               return;
-
-       slash = find_last_dir_sep(argv0);
-
-       if (slash)
-               argv0_path = xstrndup(argv0, slash - argv0);
-}
-
 void git_set_argv_exec_path(const char *exec_path)
 {
        argv_exec_path = exec_path;