Skip to content

Commit 5175551

Browse files
committed
fix assertions
1 parent f84d7cf commit 5175551

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/buffer.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ function unmark!(buf::Buffer)
131131
end
132132

133133
function reset!(buf::Buffer)
134-
if buf.markpos == 0
135-
throw(ArgumentError("not marked"))
136-
end
134+
@assert buf.markpos > 0
137135
buf.bufferpos = buf.markpos
138136
buf.markpos = 0
139137
return buf.bufferpos
@@ -177,9 +175,7 @@ end
177175

178176
# Skip `n` bytes in the buffer.
179177
function skipbuffer!(buf::Buffer, n::Integer)
180-
if n > buffersize(buf)
181-
throw(ArgumentError("too large skip size"))
182-
end
178+
@assert n buffersize(buf)
183179
consumed!(buf, n)
184180
return buf
185181
end

0 commit comments

Comments
 (0)