From 1269548f231e839da9e53647cac3b3efd1a9a389 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Thu, 9 Feb 2017 15:56:36 +0100 Subject: Use Printf.sprintf instead of Format.sprintf when possible Minor performance tweak. Printf is more efficient for plain formats involving no boxes. --- cparser/Elab.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 69830122..ea85ad04 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -835,7 +835,7 @@ and elab_struct_or_union_info keep_ty kind loc env members attrs = let m = List.flatten m in let m,_ = mmap (fun c fld -> if fld.fld_anonymous then - let name = Format.sprintf "_%d" c in + let name = Printf.sprintf "_%d" c in {fld with fld_name = name},c+1 else fld,c) 0 m in @@ -1103,11 +1103,11 @@ module I = struct let rec zipname = function | Ztop(name, ty) -> name | Zarray(z, ty, sz, dfl, before, idx, after) -> - Format.sprintf "%s[%Ld]" (zipname z) idx + Printf.sprintf "%s[%Ld]" (zipname z) idx | Zstruct(z, id, before, fld, after) -> - Format.sprintf "%s.%s" (zipname z) fld.fld_name + Printf.sprintf "%s.%s" (zipname z) fld.fld_name | Zunion(z, id, fld) -> - Format.sprintf "%s.%s" (zipname z) fld.fld_name + Printf.sprintf "%s.%s" (zipname z) fld.fld_name let name (z, i) = zipname z -- cgit