git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: mduft@gentoo.org
Cc: git@vger.kernel.org, Tor Arntsen <tor@spacetec.no>,
	Junio C Hamano <gitster@pobox.com>,
	Erik Faye-Lund <kusmabite@gmail.com>
Subject: Re: [PATCH 2/2] Include unistd.h.
Date: Wed, 25 May 2011 21:20:45 -0500	[thread overview]
Message-ID: <20110526022045.GA8172@elie> (raw)
In-Reply-To: <1306332924-28587-3-git-send-email-mduft@gentoo.org>

Hi,

mduft@gentoo.org wrote:

> --- a/compat/fnmatch/fnmatch.c
> +++ b/compat/fnmatch/fnmatch.c
> @@ -25,6 +25,7 @@
>  # define _GNU_SOURCE	1
>  #endif
>  
> +#include <unistd.h>
>  #include <errno.h>

Given that we are touching this file anyway, how about relying on
git-compat-util for this?

That way, there is no need to debug feature test macros, order of
#includes, etc.  Untested.

-- >8 --
Subject: compat/fnmatch: use git-compat-util.h for system headers

Finding the right feature test macros and ordering of #includes to
get the desired functionality from all operating systems can be a big
pain.  Take advantage of the debugging already done and avoid future
churn by using git's usual git-compat-util for this.

In particular, the current fnmatch.c doesn't #include anything that
ought to provide NULL unless HAVE_STRING_H is defined, and it fails to
compile on Interix because of this.  Other platforms must have been
getting the macro through another header.

To make this code easier to reuse and to simplify future automated
merges from upstream, still keep the old #includes, just disabled with
"#if 0".

Reported-by: Markus Duft <mduft@gentoo.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Maybe the old #includes after #include-ing git-compat-util should be
left uncommented because harmless.

 compat/fnmatch/fnmatch.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c
index 14feac7..4bf3b5c 100644
--- a/compat/fnmatch/fnmatch.c
+++ b/compat/fnmatch/fnmatch.c
@@ -16,6 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include "git-compat-util.h"
+
+#if 0
 #if HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -46,6 +49,7 @@
 # include <wchar.h>
 # include <wctype.h>
 #endif
+#endif
 
 /* Comment out all this code if we are using the GNU C Library, and are not
    actually compiling the library itself.  This code is part of the GNU C
-- 
1.7.5.1

  parent reply	other threads:[~2011-05-26  2:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 14:15 [PATCH] Interix catch-ups for recent changes/releases mduft
2011-05-25 14:15 ` [PATCH 1/2] Add additional build options for Interix, and remove obsolete ones mduft
2011-05-25 17:51   ` Junio C Hamano
2011-05-26  6:29   ` Markus Duft
2011-05-26 18:06     ` Junio C Hamano
2011-05-25 14:15 ` [PATCH 2/2] Include unistd.h mduft
2011-05-25 18:30   ` Junio C Hamano
2011-05-25 20:37     ` Tor Arntsen
2011-05-25 21:00       ` Junio C Hamano
2011-05-25 21:52     ` Erik Faye-Lund
2011-05-26  2:20   ` Jonathan Nieder [this message]
2011-05-26 15:48     ` Junio C Hamano
2011-05-26 16:39       ` Jonathan Nieder
2011-05-30  6:51         ` Markus Duft
2011-06-15  9:31           ` Markus Duft
2011-06-15  9:48             ` Jonathan Nieder
2011-06-15 11:34               ` [PATCH] Update the Interix default build configuration mduft
2011-05-27  6:27   ` [PATCH 2/2] Include unistd.h Markus Duft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110526022045.GA8172@elie \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kusmabite@gmail.com \
    --cc=mduft@gentoo.org \
    --cc=tor@spacetec.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).