mruby-socket: inline #_new_with_prelude that is only called once.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-06-14 13:39:12 +09:00
parent ebd9f29b38
commit f7813268d6
+4 -9
View File
@@ -250,14 +250,6 @@ class TCPSocket < IPSocket
raise e
end
end
def self._new_with_prelude(*args, &pre)
o = self._allocate
o.instance_eval(&pre)
o.__send__(:initialize, *args)
o
end
#def self.gethostbyname(host)
end
@@ -277,9 +269,12 @@ class TCPServer < TCPSocket
def accept
fd = self.sysaccept
begin
TCPSocket._new_with_prelude(fd, "r+") {
s = TCPSocket._allocate
s.instance_eval{
@init_with_fd = true
}
s.__send__(:initialize, fd, "r+")
s
rescue => e
IO._sysclose(fd) rescue nil
raise e