diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-01-30 15:54:43 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-01-30 21:55:37 +0900 |
commit | 4bc343b4365fb4d3755e2f3fa5ac63c16a8cb755 (patch) | |
tree | d40a92406769a7fb8ad3bd83b3bac4d346f26fe9 /ext/socket | |
parent | 1c7bf378a1430e5855bc6d5d1a5f95adccf0daf9 (diff) | |
download | ruby-4bc343b4365fb4d3755e2f3fa5ac63c16a8cb755.tar.gz |
Extract check for RSTRING_SOCKLEN
Diffstat (limited to 'ext/socket')
-rw-r--r-- | ext/socket/extconf.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 37ff216560..4ca0983c68 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -347,10 +347,22 @@ have_type("struct sockaddr_storage", headers) have_type("struct addrinfo", headers) -if have_type("socklen_t", headers) - if try_static_assert("sizeof(socklen_t) >= sizeof(long)", headers) - $defs << "-DRSTRING_SOCKLEN=(socklen_t)RSTRING_LEN" +def check_socklen(headers) + def (fmt = "none").%(x) + x || self + end + s = checking_for("RSTRING_SOCKLEN", fmt) do + if try_static_assert("sizeof(socklen_t) >= sizeof(long)", headers) + "RSTRING_LEN" + else + "RSTRING_LENINT" + end end + $defs << "-DRSTRING_SOCKLEN=(socklen_t)"+s +end + +if have_type("socklen_t", headers) + check_socklen(headers) end have_type("struct in_pktinfo", headers) {|src| |