X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-compat-util.h;h=c1bcb001a51324ebcb66bfb0a695e20ff366df02;hb=fb9a54150d308345a7027baae528b8fe90bd41f7;hp=55456da37cdd25126b7bccae879ca500176220f9;hpb=22bac0ea528fd419cb833cab5de79a36fad91524;p=git.git diff --git a/git-compat-util.h b/git-compat-util.h index 55456da37..c1bcb001a 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -15,8 +15,9 @@ #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */ #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */ #endif -#define _GNU_SOURCE -#define _BSD_SOURCE +#define _ALL_SOURCE 1 +#define _GNU_SOURCE 1 +#define _BSD_SOURCE 1 #include #include @@ -45,7 +46,10 @@ #include #include #include +#include +#undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */ #include +#define _ALL_SOURCE 1 #ifndef NO_ICONV #include @@ -105,9 +109,12 @@ extern int git_munmap(void *start, size_t length); #endif /* NO_MMAP */ #define DEFAULT_PACKED_GIT_LIMIT \ - (sizeof(void*) >= 8 \ - ? 8 * 1024 * 1024 * 1024 \ - : 256 * 1024 * 1024) + ((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256)) + +#ifdef NO_PREAD +#define pread git_pread +extern ssize_t git_pread(int fd, void *buf, size_t count, off_t offset); +#endif #ifdef NO_SETENV #define setenv gitsetenv @@ -199,6 +206,8 @@ static inline void *xmmap(void *start, size_t length, { void *ret = mmap(start, length, prot, flags, fd, offset); if (ret == MAP_FAILED) { + if (!length) + return NULL; release_pack_memory(length); ret = mmap(start, length, prot, flags, fd, offset); if (ret == MAP_FAILED)