diff --git a/git-compat-util.h b/git-compat-util.h
index 362e040f52cf8df17811ae95e46f0b60d2b6f071..1bfbdeb94f55d57b429b91aa8762618153c34f7f 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
extern const char *githstrerror(int herror);
#endif
+#ifdef NO_MEMMEM
+#define memmem gitmemmem
+void *gitmemmem(const void *haystack, size_t haystacklen,
+ const void *needle, size_t needlelen);
+#endif
+
extern void release_pack_memory(size_t, int);
static inline char* xstrdup(const char *str)
return stream;
}
+static inline int xmkstemp(char *template)
+{
+ int fd;
+
+ fd = mkstemp(template);
+ if (fd < 0)
+ die("Unable to create temporary file: %s", strerror(errno));
+ return fd;
+}
+
static inline size_t xsize_t(off_t len)
{
return (size_t)len;