Skip to content

Commit db32d6a

Browse files
committed
Ocamlbuild: make log printing code tail-recursive
Patch by Frédéric Bour git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14716 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1 parent a72d304 commit db32d6a

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

ocamlbuild/ocamlbuild_executor.ml

+8-11
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,15 @@ let output_lines prefix oc buffer =
6363
output_char oc '\n'
6464
in
6565
let rec loop i =
66-
if i = m then
67-
()
66+
if i < m then
67+
let j =
68+
try String.index_from u i '\n'
69+
with Not_found -> m
70+
in
71+
output_line i j;
72+
loop (j + 1)
6873
else
69-
begin
70-
try
71-
let j = String.index_from u i '\n' in
72-
output_line i j;
73-
loop (j + 1)
74-
with
75-
| Not_found ->
76-
output_line i m
77-
end
74+
()
7875
in
7976
loop 0
8077
;;

0 commit comments

Comments
 (0)