Re: [PATCH] index-pack usage of mmap() is unacceptably slower on many OSes other than Linux
- From
- Jeff Garzik <jeff@garzik.org>
- Date
- Dec 19, 2006, 20:02 UTC
- Message-ID
- <4588453A.3060904@garzik.org>
- In-Reply-To
- <Pine.LNX.4.64.0612191148270.3483@woody.osdl.org>
Linus Torvalds wrote:
Show 35 quoted lines
> diff --git a/convert-objects.c b/convert-objects.c > index 8812583..a630132 100644 > --- a/convert-objects.c > +++ b/convert-objects.c > @@ -1,7 +1,3 @@ > -#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 */ > -#define _GNU_SOURCE > -#include <time.h> > #include "cache.h" > #include "blob.h" > #include "commit.h" > diff --git a/git-compat-util.h b/git-compat-util.h > index 0272d04..e619e29 100644 > --- a/git-compat-util.h > +++ b/git-compat-util.h > @@ -11,6 +11,10 @@ > > #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) > > +#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 */ > +#define _GNU_SOURCE > + > #include <unistd.h> > #include <stdio.h> > #include <sys/stat.h> > @@ -25,6 +29,10 @@ > #include <netinet/in.h> > #include <sys/types.h> > #include <dirent.h> > +#include <sys/time.h> > +#include <time.h> > +#include <signal.h> > +#include <sys/wait.h>
If you are going to do this, you have to audit -every- file, to make sure git-compat-util.h is -always- the first header.
For example, builtin-mailinfo.c includes git-compat-util.h after ctype.h and iconv.h, which renders your #define _XOPEN_SOURCE 600 useless. /usr/include/features.h has already been included at that point.
Jeff