Skip to content

Commit 28d66b1

Browse files
committed
Keep skipchars from allocating unnecessary String
Remove usage of readline from skipchars definition.
1 parent 2cd7855 commit 28d66b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

base/io.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -1127,10 +1127,10 @@ julia> String(readavailable(buf))
11271127
```
11281128
"""
11291129
function skipchars(predicate, io::IO; linecomment=nothing)
1130-
while !eof(io)
1131-
c = read(io, Char)
1130+
for c in eachof(io, Char)
11321131
if c === linecomment
1133-
readline(io)
1132+
skipchars(c -> c !== '\n', io)
1133+
read(io, Char)
11341134
elseif !predicate(c)
11351135
skip(io, -ncodeunits(c))
11361136
break

0 commit comments

Comments
 (0)