diff options
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index d493a8c67a..f6d3a46622 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -116,9 +116,6 @@ #include <sys/time.h> #include <time.h> #include <signal.h> -#ifndef USE_WILDMATCH -#include <fnmatch.h> -#endif #include <assert.h> #include <regex.h> #include <utime.h> @@ -304,16 +301,7 @@ extern char *gitbasename(char *); #include "compat/bswap.h" -#ifdef USE_WILDMATCH #include "wildmatch.h" -#define FNM_PATHNAME WM_PATHNAME -#define FNM_CASEFOLD WM_CASEFOLD -#define FNM_NOMATCH WM_NOMATCH -static inline int fnmatch(const char *pattern, const char *string, int flags) -{ - return wildmatch(pattern, string, flags, NULL); -} -#endif /* General helper functions */ extern void vreportf(const char *prefix, const char *err, va_list params); @@ -351,14 +339,15 @@ extern void set_error_routine(void (*routine)(const char *err, va_list params)); extern void set_die_is_recursing_routine(int (*routine)(void)); extern int starts_with(const char *str, const char *prefix); -extern int prefixcmp(const char *str, const char *prefix); extern int ends_with(const char *str, const char *suffix); -extern int suffixcmp(const char *str, const char *suffix); static inline const char *skip_prefix(const char *str, const char *prefix) { - size_t len = strlen(prefix); - return strncmp(str, prefix, len) ? NULL : str + len; + do { + if (!*prefix) + return str; + } while (*str++ == *prefix++); + return NULL; } #if defined(NO_MMAP) || defined(USE_WIN32_MMAP) @@ -480,9 +469,15 @@ extern FILE *git_fopen(const char*, const char*); #endif #ifdef SNPRINTF_RETURNS_BOGUS +#ifdef snprintf +#undef snprintf +#endif #define snprintf git_snprintf extern int git_snprintf(char *str, size_t maxsize, const char *format, ...); +#ifdef vsnprintf +#undef vsnprintf +#endif #define vsnprintf git_vsnprintf extern int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap); @@ -541,7 +536,7 @@ extern FILE *xfdopen(int fd, const char *mode); extern int xmkstemp(char *template); extern int xmkstemp_mode(char *template, int mode); extern int odb_mkstemp(char *template, size_t limit, const char *pattern); -extern int odb_pack_keep(char *name, size_t namesz, unsigned char *sha1); +extern int odb_pack_keep(char *name, size_t namesz, const unsigned char *sha1); static inline size_t xsize_t(off_t len) { |