summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Scherer <gabriel.scherer@gmail.com>2014-08-08 15:57:22 +0000
committerGabriel Scherer <gabriel.scherer@gmail.com>2014-08-08 15:57:22 +0000
commitc6d67e2bf9c1d0388de1207e930faf5f41811e1c (patch)
tree8486275dcc5e05a7016a8b815a8d77e3614e8e02
parentbfba47f9226de94eed85e92970e4bdca0ccbc22e (diff)
downloadocaml-c6d67e2bf9c1d0388de1207e930faf5f41811e1c.tar.gz
remove redundant bound checking in Buffer.blit (patch by Philippe Wang)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15073 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--stdlib/buffer.ml4
1 files changed, 3 insertions, 1 deletions
diff --git a/stdlib/buffer.ml b/stdlib/buffer.ml
index 2d6f691a27..659729d3cc 100644
--- a/stdlib/buffer.ml
+++ b/stdlib/buffer.ml
@@ -39,7 +39,7 @@ let blit src srcoff dst dstoff len =
|| dstoff < 0 || dstoff > (Bytes.length dst) - len
then invalid_arg "Buffer.blit"
else
- Bytes.blit src.buffer srcoff dst dstoff len
+ Bytes.unsafe_blit src.buffer srcoff dst dstoff len
;;
let nth b ofs =
@@ -66,6 +66,8 @@ let resize b more =
else failwith "Buffer.add: cannot grow buffer"
end;
let new_buffer = Bytes.create !new_len in
+ (* PR#6148: let's keep using [blit] rather than [unsafe_blit] in
+ this tricky function that is slow anyway. *)
Bytes.blit b.buffer 0 new_buffer 0 b.position;
b.buffer <- new_buffer;
b.length <- !new_len