diff options
| author | Tomoyuki Sahara <[email protected]> | 2014-12-17 13:35:34 +0900 |
|---|---|---|
| committer | Tomoyuki Sahara <[email protected]> | 2014-12-17 13:35:34 +0900 |
| commit | 50721e9bf88a40f45c53d83ced3e0d6702c062f5 (patch) | |
| tree | 41a73eb2493594ea7fe142066b92030fb59cd17c | |
| parent | ee347f34171c878cc156f78a4aa0e49b0f3e04b7 (diff) | |
| parent | 9b13a59a55f43486112d98ec5df905b1fd2fdf94 (diff) | |
| download | mruby-50721e9bf88a40f45c53d83ced3e0d6702c062f5.tar.gz mruby-50721e9bf88a40f45c53d83ced3e0d6702c062f5.zip | |
Merge pull request #32 from tmtm/fix-read-create-many-objects
FIX: IO#read create a large number of objects.
| -rw-r--r-- | mrblib/io.rb | 10 |
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 |
