45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
From e0798c2658a1f9f44380224b93de7e42869b3a3b Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Wed, 16 Apr 2025 21:31:49 +0100
|
|
Subject: [PATCH] Update common submodule
|
|
|
|
Richard W.M. Jones (1):
|
|
mlstdutils: Implement String.implode
|
|
|
|
(cherry picked from commit c7930f21405720f51d74efa9f6f7b9da0132a929)
|
|
---
|
|
common | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
Submodule common 93a7f3af..9c178a92:
|
|
diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml
|
|
index 86b21a7c..1177ff69 100644
|
|
--- a/common/mlstdutils/std_utils.ml
|
|
+++ b/common/mlstdutils/std_utils.ml
|
|
@@ -256,6 +256,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 a39ac5f3..6811b4bc 100644
|
|
--- a/common/mlstdutils/std_utils.mli
|
|
+++ b/common/mlstdutils/std_utils.mli
|
|
@@ -123,6 +123,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
|