ruby-changes:62750
From: Masaki <ko1@a...>
Date: Sat, 29 Aug 2020 17:19:40 +0900 (JST)
Subject: [ruby-changes:62750] 6d946665bd (master): Show deprecation warning on Socket.gethostbyname and Socket.gethostbyaddr
https://git.ruby-lang.org/ruby.git/commit/?id=6d946665bd From 6d946665bd79a93fb98b2d25400d1b6174472302 Mon Sep 17 00:00:00 2001 From: Masaki Matsushita <glass.saga@g...> Date: Sat, 29 Aug 2020 17:18:59 +0900 Subject: Show deprecation warning on Socket.gethostbyname and Socket.gethostbyaddr diff --git a/ext/socket/socket.c b/ext/socket/socket.c index edf5f00..dc6588f 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -965,6 +965,7 @@ sock_sockaddr(struct sockaddr *addr, socklen_t len) https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L965 static VALUE sock_s_gethostbyname(VALUE obj, VALUE host) { + rb_warn("Socket.gethostbyname is deprecated; use Addrinfo.getaddrinfo instead."); struct rb_addrinfo *res = rsock_addrinfo(host, Qnil, AF_UNSPEC, SOCK_STREAM, AI_CANONNAME); return rsock_make_hostent(host, res, sock_sockaddr); @@ -1004,6 +1005,8 @@ sock_s_gethostbyaddr(int argc, VALUE *argv, VALUE _) https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L1005 VALUE ary, names; int t = AF_INET; + rb_warn("Socket.gethostbyaddr is deprecated; use Addrinfo#getnameinfo instead."); + rb_scan_args(argc, argv, "11", &addr, &family); StringValue(addr); if (!NIL_P(family)) { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/