summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2009-03-20 15:22:56 +0100
committerBruno Haible <bruno@clisp.org>2009-03-20 15:22:56 +0100
commit44608e67a858cbc42b5d6eddd88989e7a1c2d8f9 (patch)
treeffcb46e5aa3788eb7f563b83c5ad63caaf54fcbf
parentdbebf0e0bf26b9150a49db01ef66d40579eadb5e (diff)
downloadgnulib-44608e67a858cbc42b5d6eddd88989e7a1c2d8f9.tar.gz
Make sockets.h self-contained.
-rw-r--r--ChangeLog6
-rw-r--r--lib/sockets.c7
-rw-r--r--lib/sockets.h10
3 files changed, 18 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0bc942d6f1..4a2310199e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-20 Bruno Haible <bruno@clisp.org>
+
+ Make sockets.h self-contained.
+ * lib/sockets.c: Include sockets.h first.
+ * lib/sockets.h: Include <sys/socket.h> before using the SOCKET type.
+
2009-03-19 Eric Blake <ebb9@byu.net>
doc: mention more functions added in cygwin 1.7.0
diff --git a/lib/sockets.c b/lib/sockets.c
index 658119ea43..cbec12dbcc 100644
--- a/lib/sockets.c
+++ b/lib/sockets.c
@@ -1,6 +1,6 @@
/* sockets.c --- wrappers for Windows socket functions
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,11 +19,12 @@
#include <config.h>
+/* Specification. */
+#include "sockets.h"
+
/* This includes winsock2.h on MinGW. */
#include <sys/socket.h>
-#include "sockets.h"
-
int
gl_sockets_startup (int version)
{
diff --git a/lib/sockets.h b/lib/sockets.h
index bf180ac95d..b42e368d21 100644
--- a/lib/sockets.h
+++ b/lib/sockets.h
@@ -33,13 +33,19 @@ int gl_sockets_cleanup (void);
Winsock wrappers but needs to pass on the socket handle to some
other library that only accepts sockets. */
#if WINDOWS_SOCKETS
+
+#include <sys/socket.h>
+
static inline SOCKET
gl_fd_to_handle (int fd)
{
return _get_osfhandle (fd);
}
+
#else
+
#define gl_fd_to_handle(x) (x)
-#endif
-#endif
+#endif /* WINDOWS_SOCKETS */
+
+#endif /* SOCKETS_H */