#6577: fix performance of %C format.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15321 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Alain Frisch 2014-09-24 09:26:19 +00:00
parent f8ca8db7bb
commit bc3439603a
1 changed files with 5 additions and 1 deletions

View File

@ -1344,7 +1344,11 @@ let convert_float fconv prec x =
(* Convert a char to a string according to the OCaml lexical convention. *)
let format_caml_char c =
String.concat (Char.escaped c) ["'"; "'"]
let str = Char.escaped c in
let l = String.length str in
let res = Bytes.make (l + 2) '\'' in
String.unsafe_blit str 0 res 1 l;
Bytes.unsafe_to_string res
(* Convert a format type to string *)
let string_of_fmtty fmtty =