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

ruby-changes:37458

From: nobu <ko1@a...>
Date: Sun, 8 Feb 2015 10:35:42 +0900 (JST)
Subject: [ruby-changes:37458] nobu:r49539 (trunk): socket/extconf.rb: reduce duplicated code

nobu	2015-02-08 10:35:18 +0900 (Sun, 08 Feb 2015)

  New Revision: 49539

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

  Log:
    socket/extconf.rb: reduce duplicated code
    
    * ext/socket/extconf.rb: reduce duplicated code.  set fallback
      value first, then check OS-provided functions.

  Modified files:
    trunk/ext/socket/extconf.rb
Index: ext/socket/extconf.rb
===================================================================
--- ext/socket/extconf.rb	(revision 49538)
+++ ext/socket/extconf.rb	(revision 49539)
@@ -565,29 +565,15 @@ EOS https://github.com/ruby/ruby/blob/trunk/ext/socket/extconf.rb#L565
   case enable_config("wide-getaddrinfo")
   when true
     getaddr_info_ok = :wide
-  when nil
+  when nil, false
+    getaddr_info_ok = (:wide if getaddr_info_ok.nil?)
     if have_func("getnameinfo", headers) and have_func("getaddrinfo", headers)
-      getaddr_info_ok = :os
-      if !CROSS_COMPILING &&
-         !checking_for("system getaddrinfo working") {
+      if CROSS_COMPILING ||
+         checking_for("system getaddrinfo working") {
            try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
          }
-        getaddr_info_ok = :wide
+        getaddr_info_ok = :os
       end
-    else
-      getaddr_info_ok = :wide
-    end
-  when false
-    if have_func("getnameinfo", headers) and have_func("getaddrinfo", headers)
-      getaddr_info_ok = :os
-      if !CROSS_COMPILING &&
-         !checking_for("system getaddrinfo working") {
-           try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
-         }
-        getaddr_info_ok = nil
-      end
-    else
-      getaddr_info_ok = nil
     end
   else
     raise "unexpected enable_config() value"

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

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