diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-08 01:35:18 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-08 01:35:18 +0000 |
commit | 32c19cdc391d6c9149e9fa3e917697bf9ac97d4d (patch) | |
tree | ab418761f5bc977a17ef583d03a0274023cd3820 /ext/socket/extconf.rb | |
parent | d9bc7904faa60f67886d86f2bb49ec4b54ae9cf5 (diff) |
socket/extconf.rb: reduce duplicated code
* ext/socket/extconf.rb: reduce duplicated code. set fallback
value first, then check OS-provided functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/extconf.rb')
-rw-r--r-- | ext/socket/extconf.rb | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index c4523da24d..931ff990fb 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -565,29 +565,15 @@ EOS 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" |