summaryrefslogtreecommitdiff
path: root/otherlibs/str
diff options
context:
space:
mode:
authorJun FURUSE / 古瀬 淳 <jun.furuse@gmail.com>2008-01-28 05:29:20 +0000
committerJun FURUSE / 古瀬 淳 <jun.furuse@gmail.com>2008-01-28 05:29:20 +0000
commit3f4a98da0fbf8a87c674d6737d8c6cec7e8567e5 (patch)
treef5aa13505824d708414ece1f00219b811315c44a /otherlibs/str
parent30f3fa2c5bc27f8c59930741aa1b6dd5a34a6b40 (diff)
downloadocaml-gcaml3090.tar.gz
3.09.1 updategcaml3090
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gcaml3090@8792 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/str')
-rw-r--r--otherlibs/str/str.ml4
1 files changed, 3 insertions, 1 deletions
diff --git a/otherlibs/str/str.ml b/otherlibs/str/str.ml
index f443c503ff..31b6232841 100644
--- a/otherlibs/str/str.ml
+++ b/otherlibs/str/str.ml
@@ -227,7 +227,9 @@ let compile fold_case re =
(* Add a new instruction *)
let emit_instr opc arg =
if !progpos >= Array.length !prog then begin
- let nprog = Array.make (2 * Array.length !prog) 0 in
+ let newlen = ref (Array.length !prog) in
+ while !progpos >= !newlen do newlen := !newlen * 2 done;
+ let nprog = Array.make !newlen 0 in
Array.blit !prog 0 nprog 0 (Array.length !prog);
prog := nprog
end;