Merge branch 'sg/index-format-doc-update' into maint
[git/debian.git] / compat / win32 / path-utils.h
blob65fa3b9263a47c2dfaad4a110c253cbaae88fc7b
1 #ifndef WIN32_PATH_UTILS_H
2 #define WIN32_PATH_UTILS_H
4 int win32_has_dos_drive_prefix(const char *path);
5 #define has_dos_drive_prefix win32_has_dos_drive_prefix
7 int win32_skip_dos_drive_prefix(char **path);
8 #define skip_dos_drive_prefix win32_skip_dos_drive_prefix
9 #define is_dir_sep is_xplatform_dir_sep
10 static inline char *win32_find_last_dir_sep(const char *path)
12 char *ret = NULL;
13 for (; *path; ++path)
14 if (is_dir_sep(*path))
15 ret = (char *)path;
16 return ret;
18 #define find_last_dir_sep win32_find_last_dir_sep
19 static inline int win32_has_dir_sep(const char *path)
22 * See how long the non-separator part of the given path is, and
23 * if and only if it covers the whole path (i.e. path[len] is NUL),
24 * there is no separator in the path---otherwise there is a separator.
26 size_t len = strcspn(path, "/\\");
27 return !!path[len];
29 #define has_dir_sep(path) win32_has_dir_sep(path)
30 int win32_offset_1st_component(const char *path);
31 #define offset_1st_component win32_offset_1st_component
33 #endif