From 44608e67a858cbc42b5d6eddd88989e7a1c2d8f9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 20 Mar 2009 15:22:56 +0100 Subject: [PATCH] Make sockets.h self-contained. --- ChangeLog | 6 ++++++ lib/sockets.c | 7 ++++--- lib/sockets.h | 10 ++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bc942d6f..4a2310199 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-03-20 Bruno Haible + + Make sockets.h self-contained. + * lib/sockets.c: Include sockets.h first. + * lib/sockets.h: Include before using the SOCKET type. + 2009-03-19 Eric Blake doc: mention more functions added in cygwin 1.7.0 diff --git a/lib/sockets.c b/lib/sockets.c index 658119ea4..cbec12dbc 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 +/* Specification. */ +#include "sockets.h" + /* This includes winsock2.h on MinGW. */ #include -#include "sockets.h" - int gl_sockets_startup (int version) { diff --git a/lib/sockets.h b/lib/sockets.h index bf180ac95..b42e368d2 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 + 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 */ -- 2.11.0