summaryrefslogtreecommitdiff
path: root/src/path.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-05-24 11:09:38 +0200
committerPatrick Steinhardt <ps@pks.im>2017-10-09 11:19:41 +0200
commitf38ce9b61dee1bb2d3ba495937c685311f196574 (patch)
tree2470c0b1ce1baf6a38646d48b1c787e2e5d92d5b /src/path.h
parente54cf1a3eed8f2375b9e5d4dac9bf4ded57bdd01 (diff)
downloadlibgit2-f38ce9b61dee1bb2d3ba495937c685311f196574.tar.gz
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.
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/path.h b/src/path.h
index d674b1b94..aa24bcd2f 100644
--- a/src/path.h
+++ b/src/path.h
@@ -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
/**