Skip to content

Commit

Permalink
Merge branch 'rs/inline-compat-path-macros'
Browse files Browse the repository at this point in the history
* rs/inline-compat-path-macros:
  turn path macros into inline function
  • Loading branch information
Junio C Hamano committed Sep 9, 2014
2 parents 8015a60 + bf72834 commit 73353e0
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 73353e0

Please sign in to comment.