[Libguestfs] [PATCH] mllib: Add isspace, triml, trimr and trim functions.
Pino Toscano
ptoscano at redhat.com
Wed Jun 29 08:58:32 UTC 2016
On Thursday 16 June 2016 14:44:19 Richard W.M. Jones wrote:
> ---
> mllib/common_utils.ml | 29 +++++++++++++++++++++++++++++
> mllib/common_utils.mli | 8 ++++++++
> 2 files changed, 37 insertions(+)
The patch makes sense to me, I'd like to use these in the customize
code. Just one note below.
> diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
> index 64bf3d3..34e1285 100644
> --- a/mllib/common_utils.ml
> +++ b/mllib/common_utils.ml
> @@ -49,6 +49,35 @@ module String = struct
> and len = length str in
> len >= sufflen && sub str (len - sufflen) sufflen = suffix
>
> + (* Note OCaml stdlib has an "is_space" function. *)
> + let isspace c =
> + c = ' '
> + (* || c = '\f' *) || c = '\n' || c = '\r' || c = '\t' (* || c = '\v' *)
Since it's new code for Common_utils, why not just use the standard
is_space here, and in case provide an own function only where needed?
This way we can easily drop these implementations when bumping the
required OCaml version to 4.00.
Thanks,
--
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160629/e859112e/attachment.sig>
More information about the Libguestfs
mailing list