[前][次][番号順一覧][スレッド一覧]

ruby-changes:33067

From: nobu <ko1@a...>
Date: Sun, 23 Feb 2014 10:29:29 +0900 (JST)
Subject: [ruby-changes:33067] nobu:r45146 (trunk): raddrinfo.c: suppress warnings

nobu	2014-02-23 10:29:25 +0900 (Sun, 23 Feb 2014)

  New Revision: 45146

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45146

  Log:
    raddrinfo.c: suppress warnings
    
    * ext/socket/raddrinfo.c (numeric_getaddrinfo): move conditionally
      used variables inside the block, to suppress warnings on platforms
      where inet_pton() is not available.

  Modified files:
    trunk/ext/socket/raddrinfo.c
Index: ext/socket/raddrinfo.c
===================================================================
--- ext/socket/raddrinfo.c	(revision 45145)
+++ ext/socket/raddrinfo.c	(revision 45146)
@@ -176,19 +176,17 @@ numeric_getaddrinfo(const char *node, co https://github.com/ruby/ruby/blob/trunk/ext/socket/raddrinfo.c#L176
         const struct addrinfo *hints,
         struct addrinfo **res)
 {
-    static const struct {
-        int socktype;
-        int protocol;
-    } list[] = {
-        { SOCK_STREAM, IPPROTO_TCP },
-        { SOCK_DGRAM, IPPROTO_UDP },
-        { SOCK_RAW, 0 }
-    };
-
-    struct addrinfo *ai = NULL;
-
 #ifdef HAVE_INET_PTON
     if (node && (!service || strspn(service, "0123456789") == strlen(service))) {
+	static const struct {
+	    int socktype;
+	    int protocol;
+	} list[] = {
+	    { SOCK_STREAM, IPPROTO_TCP },
+	    { SOCK_DGRAM, IPPROTO_UDP },
+	    { SOCK_RAW, 0 }
+	};
+	struct addrinfo *ai = NULL;
         int port = service ? (unsigned short)atoi(service): 0;
         int hint_family = hints ? hints->ai_family : PF_UNSPEC;
         int hint_socktype = hints ? hints->ai_socktype : 0;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]