diff options
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index aed0b5d4f9..5637114b8d 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -389,6 +389,14 @@ static inline char *git_find_last_dir_sep(const char *path) #define find_last_dir_sep git_find_last_dir_sep #endif +#ifndef has_dir_sep +static inline int git_has_dir_sep(const char *path) +{ + return !!strchr(path, '/'); +} +#define has_dir_sep(path) git_has_dir_sep(path) +#endif + #ifndef query_user_email #define query_user_email() NULL #endif @@ -861,6 +869,12 @@ FILE *fopen_for_writing(const char *path); FILE *fopen_or_warn(const char *path, const char *mode); /* + * Like strncmp, but only return zero if s is NUL-terminated and exactly len + * characters long. If it is not, consider it greater than t. + */ +int xstrncmpz(const char *s, const char *t, size_t len); + +/* * FREE_AND_NULL(ptr) is like free(ptr) followed by ptr = NULL. Note * that ptr is used twice, so don't pass e.g. ptr++. */ @@ -1208,13 +1222,6 @@ int access_or_die(const char *path, int mode, unsigned flag); /* Warn on an inaccessible file if errno indicates this is an error */ int warn_on_fopen_errors(const char *path); -#ifdef GMTIME_UNRELIABLE_ERRORS -struct tm *git_gmtime(const time_t *); -struct tm *git_gmtime_r(const time_t *, struct tm *); -#define gmtime git_gmtime -#define gmtime_r git_gmtime_r -#endif - #if !defined(USE_PARENS_AROUND_GETTEXT_N) && defined(__GNUC__) #define USE_PARENS_AROUND_GETTEXT_N 1 #endif |