summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorMarius Storm-Olsen <mstormo@gmail.com>2009-09-16 10:20:26 +0200
committerJunio C Hamano <gitster@pobox.com>2009-09-18 20:00:42 -0700
commit435bdf8c7ffa493f8f6f2e8f329f8cc22db16ce6 (patch)
tree99c9c20ae9a3913ea1fbf801ca1821fcb2b5e00c /git-compat-util.h
parentd75f8e61315cc502c34aec6600db00a7c7192ffd (diff)
downloadgit-435bdf8c7ffa493f8f6f2e8f329f8cc22db16ce6.tar.gz
Make usage of windows.h lean and mean
Centralize the include of windows.h in git-compat-util.h, turn on WIN32_LEAN_AND_MEAN to avoid including plenty of other header files which is not needed in Git. Also ensure we load winsock2.h first, so we don't load the older winsock definitions at a later stage, since they contain duplicate definitions. When moving windows.h into git-compat-util.h, we need to protect the definition of struct pollfd in mingw.h, since this file is used by both MinGW and MSVC, and the latter defines this struct in winsock2.h. We need to keep the windows.h include in compat/win32.h, since its shared by both MinGW and Cygwin, and we're not touching Cygwin in this commit. The include in git-compat-util.h is protected with an ifdef WIN32, which is not the case when compiling for Cygwin. Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 8ea444fdc0..8d6e29cdea 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -65,6 +65,12 @@
#define _NETBSD_SOURCE 1
#define _SGI_SOURCE 1
+#ifdef WIN32 /* Both MinGW and MSVC */
+#define WIN32_LEAN_AND_MEAN /* stops windows.h including winsock.h */
+#include <winsock2.h>
+#include <windows.h>
+#endif
+
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>