mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Define PATH_SEP to ':' or ';' as needed.
This reduces the number of conditionals in the code. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
This commit is contained in:
@@ -192,6 +192,7 @@ sig_handler_t mingw_signal(int sig, sig_handler_t handler);
|
||||
* git specific compatibility
|
||||
*/
|
||||
|
||||
#define PATH_SEP ';'
|
||||
#define PRIuMAX "I64u"
|
||||
|
||||
/*
|
||||
|
||||
@@ -70,11 +70,7 @@ static void add_path(struct strbuf *out, const char *path)
|
||||
else
|
||||
strbuf_addstr(out, make_absolute_path(path));
|
||||
|
||||
#ifdef __MINGW32__
|
||||
strbuf_addch(out, ';');
|
||||
#else
|
||||
strbuf_addch(out, ':');
|
||||
#endif
|
||||
strbuf_addch(out, PATH_SEP);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +109,10 @@
|
||||
#define PRIuMAX "llu"
|
||||
#endif
|
||||
|
||||
#ifndef PATH_SEP
|
||||
#define PATH_SEP ':'
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define NORETURN __attribute__((__noreturn__))
|
||||
#else
|
||||
|
||||
7
help.c
7
help.c
@@ -240,11 +240,6 @@ static unsigned int load_command_list(void)
|
||||
const char *env_path = getenv("PATH");
|
||||
char *paths, *path, *colon;
|
||||
const char *exec_path = git_exec_path();
|
||||
#ifdef __MINGW32__
|
||||
char sep = ';';
|
||||
#else
|
||||
char sep = ':';
|
||||
#endif
|
||||
|
||||
if (exec_path)
|
||||
longest = list_commands_in_dir(&main_cmds, exec_path);
|
||||
@@ -256,7 +251,7 @@ static unsigned int load_command_list(void)
|
||||
|
||||
path = paths = xstrdup(env_path);
|
||||
while (1) {
|
||||
if ((colon = strchr(path, sep)))
|
||||
if ((colon = strchr(path, PATH_SEP)))
|
||||
*colon = 0;
|
||||
|
||||
len = list_commands_in_dir(&other_cmds, path);
|
||||
|
||||
@@ -394,11 +394,7 @@ void prepare_alt_odb(void)
|
||||
if (!alt) alt = "";
|
||||
|
||||
alt_odb_tail = &alt_odb_list;
|
||||
#ifdef __MINGW32__
|
||||
link_alt_odb_entries(alt, alt + strlen(alt), ';', NULL, 0);
|
||||
#else
|
||||
link_alt_odb_entries(alt, alt + strlen(alt), ':', NULL, 0);
|
||||
#endif
|
||||
link_alt_odb_entries(alt, alt + strlen(alt), PATH_SEP, NULL, 0);
|
||||
|
||||
read_info_alternates(get_object_directory(), 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user