summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 309240bbce..7534db1267 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1,6 +1,8 @@
#ifndef GIT_COMPAT_UTIL_H
#define GIT_COMPAT_UTIL_H
+#define _FILE_OFFSET_BITS 64
+
#ifndef FLEX_ARRAY
#if defined(__GNUC__) && (__GNUC__ < 3)
#define FLEX_ARRAY 0
@@ -68,6 +70,10 @@
#define PATH_MAX 4096
#endif
+#ifndef PRIuMAX
+#define PRIuMAX "llu"
+#endif
+
#ifdef __GNUC__
#define NORETURN __attribute__((__noreturn__))
#else
@@ -252,6 +258,11 @@ static inline ssize_t xwrite(int fd, const void *buf, size_t len)
}
}
+static inline size_t xsize_t(off_t len)
+{
+ return (size_t)len;
+}
+
static inline int has_extension(const char *filename, const char *ext)
{
size_t len = strlen(filename);
@@ -285,4 +296,9 @@ static inline int sane_case(int x, int high)
return x;
}
+static inline int prefixcmp(const char *str, const char *prefix)
+{
+ return strncmp(str, prefix, strlen(prefix));
+}
+
#endif