Skip to content

Commit 0414b9a

Browse files
committed
No need to clear the buffer a second time in StringIO#sysread and #read_nonblock
* StringIO#read already clears it when returning nil.
1 parent 9b47742 commit 0414b9a

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

lib/truffle/stringio.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,6 @@ def sysread(length = nil, buffer = '')
526526
str = read(length, buffer)
527527

528528
if str.nil?
529-
buffer.clear
530529
raise EOFError, 'end of file reached'
531530
end
532531

@@ -539,7 +538,6 @@ def read_nonblock(length, buffer = '', exception: true)
539538
str = read(length, buffer)
540539

541540
if exception and str.nil?
542-
buffer.clear
543541
raise EOFError, 'end of file reached'
544542
end
545543

0 commit comments

Comments
 (0)