Commit f38ce9b6 by Patrick Steinhardt

path: expose `git_path_is_dirsep`

This function has previously been implemented in Windows-specific path
handling code as `path__is_dirsep`. As we will need this functionality
in other parts, extract the logic into "path.h" alongside with a
non-Windows implementation.
parent e54cf1a3
......@@ -108,6 +108,9 @@ GIT_INLINE(int) git_path_is_dot_or_dotdotW(const wchar_t *name)
#define git_path_is_absolute(p) \
(git__isalpha((p)[0]) && (p)[1] == ':' && ((p)[2] == '\\' || (p)[2] == '/'))
#define git_path_is_dirsep(p) \
((p) == '/' || (p) == '\\')
/**
* Convert backslashes in path to forward slashes.
*/
......@@ -126,6 +129,9 @@ GIT_INLINE(void) git_path_mkposix(char *path)
#define git_path_is_absolute(p) \
((p)[0] == '/')
#define git_path_is_dirsep(p) \
((p) == '/')
#endif
/**
......
......@@ -18,8 +18,6 @@
#define PATH__ABSOLUTE_LEN 3
#define path__is_dirsep(p) ((p) == '/' || (p) == '\\')
#define path__is_nt_namespace(p) \
(((p)[0] == '\\' && (p)[1] == '\\' && (p)[2] == '?' && (p)[3] == '\\') || \
((p)[0] == '/' && (p)[1] == '/' && (p)[2] == '?' && (p)[3] == '/'))
......@@ -56,7 +54,7 @@ static wchar_t *path__skip_server(wchar_t *path)
wchar_t *c;
for (c = path; *c; c++) {
if (path__is_dirsep(*c))
if (git_path_is_dirsep(*c))
return c + 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment