X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-compat-util.h;h=cf89cdf4598b3796724a85aa707f740245155cdc;hb=fc721b699b817e9cb78994c6dd6d86e744bd2112;hp=545df5924247c9d4ffe700db6c158715561f6a62;hpb=86d72443215612f66f77dfc57ec9613c8153617c;p=git.git diff --git a/git-compat-util.h b/git-compat-util.h index 545df5924..cf89cdf45 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -110,6 +110,14 @@ #define PRIuMAX "llu" #endif +#ifndef PRIu32 +#define PRIu32 "u" +#endif + +#ifndef PRIx32 +#define PRIx32 "x" +#endif + #ifndef PATH_SEP #define PATH_SEP ':' #endif @@ -149,6 +157,12 @@ extern void set_warn_routine(void (*routine)(const char *warn, va_list params)); extern int prefixcmp(const char *str, const char *prefix); extern time_t tm_to_time_t(const struct tm *tm); +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; +} + #ifdef NO_MMAP #ifndef PROT_READ