mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix _read_buf to be more efficient; fix #4982
The bug was introduced by #4712. The `getc' problem resurrected. It should be addressed soon.
This commit is contained in:
committed by
Hiroshi Mimaki
parent
a2b87c033a
commit
e77e6e9d12
@@ -170,13 +170,8 @@ class IO
|
||||
end
|
||||
|
||||
def _read_buf
|
||||
return @buf if @buf && @buf.bytesize >= 4 # maximum UTF-8 character is 4 bytes
|
||||
@buf ||= ""
|
||||
begin
|
||||
@buf += sysread(BUF_SIZE)
|
||||
rescue EOFError => e
|
||||
raise e if @buf.empty?
|
||||
end
|
||||
return @buf if @buf && @buf.bytesize > 0
|
||||
sysread(BUF_SIZE, @buf)
|
||||
end
|
||||
|
||||
def ungetc(substr)
|
||||
|
||||
Reference in New Issue
Block a user