bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] gethostname: further tweaks


From: Eric Blake
Subject: [PATCH] gethostname: further tweaks
Date: Mon, 22 Mar 2010 14:21:10 -0600

* lib/unistd.in.h (includes): Only worry about <winsock2.h> if we
are overriding gethostname.
Suggested by Bruno Haible.

Signed-off-by: Eric Blake <address@hidden>
---

> Would it be possible to conditionalize this with
>   #if @GNULIB_GETHOSTNAME@
> like it was before? In a package that has nothing to do with
> sockets and nothing to do with gethostname(), I wouldn't want to
> see all <winsock2.h> definitions in virtually all compilation units.

Good point - I don't think there is anything besides gethostname that
was causing interference; we only have to ensure that winsock2.h is
completely in if we plan on tweaking something only natively provided
by winsock2.h.  Pushing this followup.

 ChangeLog       |    5 +++++
 lib/unistd.in.h |    7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e948579..cec4dec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-03-22  Eric Blake  <address@hidden>

+       gethostname: further tweaks
+       * lib/unistd.in.h (includes): Only worry about <winsock2.h> if we
+       are overriding gethostname.
+       Suggested by Bruno Haible.
+
        gethostname: fix build on mingw
        * lib/unistd.in.h (includes): Work around fact that mingw
        <winsock2.h> re-includes <unistd.h>, by avoiding any
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index beef6b0..a60d483 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -19,8 +19,8 @@
    - On mingw, several headers, including <winsock2.h>, include <unistd.h>,
      but we need to ensure that both the system <unistd.h> and <winsock2.h>
      are completely included before we replace gethostname.  */
-#if @UNISTD_H_HAVE_WINSOCK2_H@ && !defined _GL_WINSOCK2_H_WITNESS \
-  && defined _WINSOCK2_H
+#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
+  && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H
 /* <unistd.h> is being indirectly included for the first time from
    <winsock2.h>; avoid declaring any overrides.  */
 # if @HAVE_UNISTD_H@
@@ -43,7 +43,8 @@
 #endif

 /* Get all possible declarations of gethostname().  */
-#if @UNISTD_H_HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
+#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
+  && !defined _GL_INCLUDING_WINSOCK2_H
 # define _GL_INCLUDING_WINSOCK2_H
 # include <winsock2.h>
 # undef _GL_INCLUDING_WINSOCK2_H
-- 
1.6.6.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]