Richard W.M. Jones
2016-Jun-14 16:12 UTC
[Libguestfs] [PATCH] generator: Remove unnecessary 'chars' function.
String.make can be used instead, and that function has been around
since at least RHEL 6 era OCaml.
---
generator/utils.ml | 9 +--------
generator/utils.mli | 3 ---
2 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/generator/utils.ml b/generator/utils.ml
index 34edf9d..6fb04dc 100644
--- a/generator/utils.ml
+++ b/generator/utils.ml
@@ -356,14 +356,7 @@ let pod2text ?width ?(trim = true) ?(discard = true) name
longdesc (* Compare two actions (for sorting). *)
let action_compare { name = n1 } { name = n2 } = compare n1 n2
-let chars c n - let str = String.create n in
- for i = 0 to n-1 do
- String.unsafe_set str i c
- done;
- str
-
-let spaces n = chars ' ' n
+let spaces n = String.make n ' '
let args_of_optargs optargs List.map (
diff --git a/generator/utils.mli b/generator/utils.mli
index aec1f71..41dd47d 100644
--- a/generator/utils.mli
+++ b/generator/utils.mli
@@ -123,9 +123,6 @@ val pod2text : ?width:int -> ?trim:bool ->
?discard:bool -> string -> string ->
val action_compare : Types.action -> Types.action -> int
(** Compare the names of two actions, for sorting. *)
-val chars : char -> int -> string
-(** [chars c n] creates a string containing character c repeated n times. *)
-
val spaces : int -> string
(** [spaces n] creates a string of n spaces. *)
--
2.7.4
Pino Toscano
2016-Jun-14 16:43 UTC
Re: [Libguestfs] [PATCH] generator: Remove unnecessary 'chars' function.
On Tuesday 14 June 2016 17:12:21 Richard W.M. Jones wrote:> String.make can be used instead, and that function has been around > since at least RHEL 6 era OCaml. > ---LGTM. -- Pino Toscano
Apparently Analagous Threads
- [PATCH] generator: Share Common_utils code.
- [PATCH] generator: Add visibility to action struct
- [PATCH 1/3] generator: add a simple HTML escaping function
- [PATCH 0/3] generator: pod2text-related improvements
- [PATCH 3/3] generator: improve pod2text invocation