Replace handwritten ppf with Format.formatter_of_buffer call

- Behavior is identical
- Makes utop forward compatible with merged PR 595 of ocaml trunk
This commit is contained in:
Richard Bonichon 2017-04-05 10:37:54 +02:00 committed by Jérémie Dimino
parent e45dcbdf9f
commit f64e9d2e78
1 changed files with 4 additions and 5 deletions

View File

@ -145,11 +145,10 @@ let collect_formatters buf pps f =
pps save
in
(* Output functions. *)
let out_string str ofs len = Buffer.add_substring buf str ofs len
and out_flush = ignore
and out_newline () = Buffer.add_char buf '\n'
and out_spaces n = for i = 1 to n do Buffer.add_char buf ' ' done in
let out_functions = { Format.out_string; out_flush; out_newline; out_spaces } in
let out_functions =
let ppb = Format.formatter_of_buffer buf in
Format.pp_get_formatter_out_functions ppb ()
in
(* Replace formatter functions. *)
List.iter
(fun pp ->