summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-09 19:54:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-09 19:54:07 (GMT)
commit73353e0f650e4b058d47b67f0e73b9a6a11ec5a1 (patch)
treeb9161b46dead3c40c25fa16a9fb47d296ff6f90c /git-compat-util.h
parent8015a607151ad986fb3625e703457d6d6e940097 (diff)
parentbf7283465b42e43b8822a8575abd1a7c6c82e7c9 (diff)
downloadgit-73353e0f650e4b058d47b67f0e73b9a6a11ec5a1.zip
git-73353e0f650e4b058d47b67f0e73b9a6a11ec5a1.tar.gz
git-73353e0f650e4b058d47b67f0e73b9a6a11ec5a1.tar.bz2
Merge branch 'rs/inline-compat-path-macros'
* rs/inline-compat-path-macros: turn path macros into inline function
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index c150e3f..d675c89 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -264,19 +264,35 @@ extern char *gitbasename(char *);
#endif
#ifndef has_dos_drive_prefix
-#define has_dos_drive_prefix(path) 0
+static inline int git_has_dos_drive_prefix(const char *path)
+{
+ return 0;
+}
+#define has_dos_drive_prefix git_has_dos_drive_prefix
#endif
-#ifndef offset_1st_component
-#define offset_1st_component(path) (is_dir_sep((path)[0]))
+#ifndef is_dir_sep
+static inline int git_is_dir_sep(int c)
+{
+ return c == '/';
+}
+#define is_dir_sep git_is_dir_sep
#endif
-#ifndef is_dir_sep
-#define is_dir_sep(c) ((c) == '/')
+#ifndef offset_1st_component
+static inline int git_offset_1st_component(const char *path)
+{
+ return is_dir_sep(path[0]);
+}
+#define offset_1st_component git_offset_1st_component
#endif
#ifndef find_last_dir_sep
-#define find_last_dir_sep(path) strrchr(path, '/')
+static inline char *git_find_last_dir_sep(const char *path)
+{
+ return strrchr(path, '/');
+}
+#define find_last_dir_sep git_find_last_dir_sep
#endif
#if defined(__HP_cc) && (__HP_cc >= 61000)