From 9b13a59a55f43486112d98ec5df905b1fd2fdf94 Mon Sep 17 00:00:00 2001 From: TOMITA Masahiro Date: Wed, 17 Dec 2014 01:05:59 +0900 Subject: FIX: IO#read create a large number of objects. --- mrblib/io.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mrblib') diff --git a/mrblib/io.rb b/mrblib/io.rb index fceea1171..51a395119 100644 --- a/mrblib/io.rb +++ b/mrblib/io.rb @@ -194,12 +194,12 @@ class IO if length && (str.size + @buf.size) >= length len = length - str.size - str += @buf[0, len] + str << @buf[0, len] @pos += len @buf = @buf[len, @buf.size - len] break else - str += @buf + str << @buf @pos += @buf.size @buf = '' end @@ -238,18 +238,18 @@ class IO if limit && (str.size + @buf.size) >= limit len = limit - str.size - str += @buf[0, len] + str << @buf[0, len] @pos += len @buf = @buf[len, @buf.size - len] break elsif idx = @buf.index(rs) len = idx + rs.size - str += @buf[0, len] + str << @buf[0, len] @pos += len @buf = @buf[len, @buf.size - len] break else - str += @buf + str << @buf @pos += @buf.size @buf = '' end -- cgit v1.2.3