summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2017-05-22 18:58:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-23 12:42:14 (GMT)
commite20b5b59099a960d59f20276ae37353870e714de (patch)
tree9b7d7408f9963b5f952141f97205f144e2990999 /compat
parent840ed141983718e0c5518a325534a5656797132a (diff)
downloadgit-e20b5b59099a960d59f20276ae37353870e714de.zip
git-e20b5b59099a960d59f20276ae37353870e714de.tar.gz
git-e20b5b59099a960d59f20276ae37353870e714de.tar.bz2
mingw.h: permit arguments with side effects for is_dir_sep
Taking git-compat-util.h's cue (which uses an inline function to back is_dir_sep()), let's use an inline function to back also the Windows version of is_dir_sep(). This avoids problems when calling the function with arguments that do more than just provide a single character, e.g. incrementing a pointer. Example: is_dir_sep(*p++) Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/mingw.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/compat/mingw.h b/compat/mingw.h
index 034fff9..d2168c1 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -395,7 +395,11 @@ HANDLE winansi_get_osfhandle(int fd);
(isalpha(*(path)) && (path)[1] == ':' ? 2 : 0)
int mingw_skip_dos_drive_prefix(char **path);
#define skip_dos_drive_prefix mingw_skip_dos_drive_prefix
-#define is_dir_sep(c) ((c) == '/' || (c) == '\\')
+static inline int mingw_is_dir_sep(int c)
+{
+ return c == '/' || c == '\\';
+}
+#define is_dir_sep mingw_is_dir_sep
static inline char *mingw_find_last_dir_sep(const char *path)
{
char *ret = NULL;