From 3f9078261ce917231eb62575557b1c9fb076a91f Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 16 Apr 2025 13:57:30 +0100 Subject: [PATCH] Update common submodule Pulls in these commits: Richard W.M. Jones (2): mltools: Fix memory leak in OCaml binding of libosinfo mlstdutils: Implement String.implode --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Submodule common 347b13716..353b8474e: diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml index 212a151..086d66d 100644 --- a/common/mlstdutils/std_utils.ml +++ b/common/mlstdutils/std_utils.ml @@ -275,6 +275,12 @@ module String = struct let map_chars f str = List.map f (explode str) + let implode cs = + let n = List.length cs in + let b = Bytes.create n in + List.iteri (Bytes.unsafe_set b) cs; + Bytes.to_string b + let spaces n = String.make n ' ' let span str accept = diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli index 72a2d44..39448fb 100644 --- a/common/mlstdutils/std_utils.mli +++ b/common/mlstdutils/std_utils.mli @@ -127,6 +127,8 @@ module String : sig (** Explode a string into a list of characters. *) val map_chars : (char -> 'a) -> string -> 'a list (** Explode string, then map function over the characters. *) + val implode : char list -> string + (** Join list of characters into a single string. *) val spaces : int -> string (** [spaces n] creates a string of n spaces. *) val span : string -> string -> int