From f64e9d2e78ed626216ad29098b23ef200ecdc770 Mon Sep 17 00:00:00 2001 From: Richard Bonichon Date: Wed, 5 Apr 2017 10:37:54 +0200 Subject: [PATCH] Replace handwritten ppf with Format.formatter_of_buffer call - Behavior is identical - Makes utop forward compatible with merged PR 595 of ocaml trunk --- src/lib/uTop.ml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/uTop.ml b/src/lib/uTop.ml index f07c808..9729a37 100644 --- a/src/lib/uTop.ml +++ b/src/lib/uTop.ml @@ -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 ->