Skip to content

Commit f781326

Browse files
committed
mruby-socket: inline #_new_with_prelude that is only called once.
1 parent ebd9f29 commit f781326

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

mrbgems/mruby-socket/mrblib/socket.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,6 @@ def initialize(host, service, local_host=nil, local_service=nil)
250250
raise e
251251
end
252252
end
253-
254-
def self._new_with_prelude(*args, &pre)
255-
o = self._allocate
256-
o.instance_eval(&pre)
257-
o.__send__(:initialize, *args)
258-
o
259-
end
260-
261253
#def self.gethostbyname(host)
262254
end
263255

@@ -277,9 +269,12 @@ def initialize(host=nil, service)
277269
def accept
278270
fd = self.sysaccept
279271
begin
280-
TCPSocket._new_with_prelude(fd, "r+") {
272+
s = TCPSocket._allocate
273+
s.instance_eval{
281274
@init_with_fd = true
282275
}
276+
s.__send__(:initialize, fd, "r+")
277+
s
283278
rescue => e
284279
IO._sysclose(fd) rescue nil
285280
raise e

0 commit comments

Comments
 (0)