use Bytes.extend (praise modernity!)

This commit is contained in:
Simon Cruanes 2014-12-16 22:50:47 +01:00
parent 059528257a
commit f229973ee3

View file

@ -123,9 +123,7 @@ let read_all ic =
while true do
(* resize *)
if !len = Bytes.length !buf then (
let buf' = Bytes.create (2* !len) in
Bytes.blit !buf 0 buf' 0 !len;
buf := buf'
buf := Bytes.extend !buf 0 !len;
);
assert (Bytes.length !buf > !len);
let n = input ic !buf !len (Bytes.length !buf - !len) in