diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-21 23:50:25 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-21 23:50:25 +0000 |
commit | c62b2cebe9a70063fda07bf4bbc0764ef9a4b99a (patch) | |
tree | 13d529c7d37ae96fa8b32243d33b7ae998e37a96 /ext | |
parent | cb528ff3c1a9e5a9a939e299b0faf10360d1292d (diff) | |
download | ruby-c62b2cebe9a70063fda07bf4bbc0764ef9a4b99a.tar.gz |
socket: use symbol proc for IO#close loops
Made possible by r56795, this reduces human and byte code size.
* ext/socket/lib/socket.rb (self.ip_sockets_port0,
self.tcp_server_sockets_port0,
self.tcp_server_sockets,
self.udp_server_sockets): use symbol proc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/socket/lib/socket.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb index 35a10de1d0..42c7edddec 100644 --- a/ext/socket/lib/socket.rb +++ b/ext/socket/lib/socket.rb @@ -675,10 +675,10 @@ class Socket < BasicSocket end } rescue Errno::EADDRINUSE - sockets.each {|s| s.close } + sockets.each(&:close) retry rescue Exception - sockets.each {|s| s.close } + sockets.each(&:close) raise end sockets @@ -695,7 +695,7 @@ class Socket < BasicSocket s.listen(Socket::SOMAXCONN) } rescue Exception - sockets.each {|s| s.close } + sockets.each(&:close) raise end sockets @@ -758,7 +758,7 @@ class Socket < BasicSocket raise last_error end rescue Exception - sockets.each {|s| s.close } + sockets.each(&:close) raise end end @@ -766,7 +766,7 @@ class Socket < BasicSocket begin yield sockets ensure - sockets.each {|s| s.close } + sockets.each(&:close) end else sockets @@ -927,7 +927,7 @@ class Socket < BasicSocket begin yield sockets ensure - sockets.each {|s| s.close } if sockets + sockets.each(&:close) if sockets end else sockets |