summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTOMITA Masahiro <[email protected]>2014-12-17 01:05:59 +0900
committerTOMITA Masahiro <[email protected]>2014-12-17 01:46:23 +0900
commit9b13a59a55f43486112d98ec5df905b1fd2fdf94 (patch)
tree41a73eb2493594ea7fe142066b92030fb59cd17c
parentee347f34171c878cc156f78a4aa0e49b0f3e04b7 (diff)
downloadmruby-9b13a59a55f43486112d98ec5df905b1fd2fdf94.tar.gz
mruby-9b13a59a55f43486112d98ec5df905b1fd2fdf94.zip
FIX: IO#read create a large number of objects.
-rw-r--r--mrblib/io.rb10
1 files changed, 5 insertions, 5 deletions
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