X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgetaddrinfo.c;h=854a7099921d560bd87dde57b9f03ff099d7efa8;hb=7422b7ede18016dea87d207cbb7535428afba3ec;hp=9109a8051f87e588062af4571acbaea22a935dba;hpb=b2e2010c7c902235b5efb5bd3c6529f61b093aa4;p=gnulib.git diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c index 9109a8051..854a70999 100644 --- a/lib/getaddrinfo.c +++ b/lib/getaddrinfo.c @@ -1,5 +1,5 @@ /* Get address information (partial implementation). - Copyright (C) 1997, 2001-2002, 2004-2010 Free Software Foundation, Inc. + Copyright (C) 1997, 2001-2002, 2004-2014 Free Software Foundation, Inc. Contributed by Simon Josefsson . This program is free software; you can redistribute it and/or modify @@ -13,15 +13,14 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include + along with this program; if not, see . */ /* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc optimizes away the sa == NULL test below. */ #define _GL_ARG_NONNULL(params) +#include + #include #if HAVE_NETINET_IN_H @@ -56,10 +55,13 @@ #endif #if defined _WIN32 || defined __WIN32__ -# define WIN32_NATIVE +# define WINDOWS_NATIVE #endif -#ifdef WIN32_NATIVE +/* gl_sockets_startup */ +#include "sockets.h" + +#ifdef WINDOWS_NATIVE typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*, const struct addrinfo*, struct addrinfo**); @@ -101,11 +103,13 @@ use_win32_p (void) return 0; } + gl_sockets_startup (SOCKETS_1_1); + return 1; } #endif -static inline bool +static bool validate_family (int family) { /* FIXME: Support more families. */ @@ -148,7 +152,7 @@ getaddrinfo (const char *restrict nodename, }; #endif -#ifdef WIN32_NATIVE +#ifdef WINDOWS_NATIVE if (use_win32_p ()) return getaddrinfo_ptr (nodename, servname, hints, res); #endif @@ -327,11 +331,11 @@ getaddrinfo (const char *restrict nodename, return 0; } -/* Free `addrinfo' structure AI including associated storage. */ +/* Free 'addrinfo' structure AI including associated storage. */ void freeaddrinfo (struct addrinfo *ai) { -#ifdef WIN32_NATIVE +#ifdef WINDOWS_NATIVE if (use_win32_p ()) { freeaddrinfo_ptr (ai); @@ -351,12 +355,13 @@ freeaddrinfo (struct addrinfo *ai) } } -int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, - char *restrict node, socklen_t nodelen, - char *restrict service, socklen_t servicelen, - int flags) +int +getnameinfo (const struct sockaddr *restrict sa, socklen_t salen, + char *restrict node, socklen_t nodelen, + char *restrict service, socklen_t servicelen, + int flags) { -#ifdef WIN32_NATIVE +#ifdef WINDOWS_NATIVE if (use_win32_p ()) return getnameinfo_ptr (sa, salen, node, nodelen, service, servicelen, flags);