Skip to content

Commit

Permalink
Use isempty instead equality with an empty buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash authored Feb 14, 2024
1 parent fb2d3a0 commit d15af85
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Connections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,12 @@ Read until `find_delimiter(bytes)` returns non-zero.
Return view of bytes up to the delimiter.
"""
function IOExtras.readuntil(c::Connection, f::F #=Vector{UInt8} -> Int=#,
sizehint=4096)::ByteView where {F <: Function}
sizehint=4096) where {F <: Function}
buf = c.buffer
if bytesavailable(buf) == 0
read_to_buffer(c, sizehint)
end
while (bytes = IOExtras.readuntil(buf, f)) == nobytes
while isempty(begin bytes = IOExtras.readuntil(buf, f) end)
read_to_buffer(c, sizehint)
end
return bytes
Expand Down

0 comments on commit d15af85

Please sign in to comment.