Displaying 5 results from an estimated 5 matches for "simple_unquote".
2017 Oct 16
2
Re: [PATCH v2 1/2] daemon: add split_key_value_strings helper
...utils.ml
> @@ -229,3 +229,19 @@ let unix_canonical_path path =
> let path = String.nsplit "/" path in
> let path = List.filter ((<>) "") path in
> (if is_absolute then "/" else "") ^ String.concat "/" path
> +
> +let simple_unquote s =
> + let n = String.length s in
> + if n >= 2 &&
> + ((s.[0] = '"' && s.[n-1] = '"') || (s.[0] = '\'' && s.[n-1] = '\'')) then
> + String.sub s 1 (n-2)
> + else
> + s
According to:
htt...
2017 Oct 16
3
[PATCH v2 0/2] daemon: add and use split_key_value_strings helper
Changes from v1 to v2:
- split the "simple unquoting" as helper
- pass the unquoting function to split_key_value_strings
- use right unquoting function when applying split_key_value_strings
Pino Toscano (2):
daemon: add split_key_value_strings helper
daemon: use split_key_value_strings
daemon/inspect_fs_unix.ml | 93 +++++++++++++++++++----------------------------
daemon/md.ml
2017 Oct 16
0
[PATCH v2 1/2] daemon: add split_key_value_strings helper
.../daemon/utils.ml
+++ b/daemon/utils.ml
@@ -229,3 +229,19 @@ let unix_canonical_path path =
let path = String.nsplit "/" path in
let path = List.filter ((<>) "") path in
(if is_absolute then "/" else "") ^ String.concat "/" path
+
+let simple_unquote s =
+ let n = String.length s in
+ if n >= 2 &&
+ ((s.[0] = '"' && s.[n-1] = '"') || (s.[0] = '\'' && s.[n-1] = '\'')) then
+ String.sub s 1 (n-2)
+ else
+ s
+
+let split_key_value_strings ?unquote lines =
+...
2017 Oct 16
0
Re: [PATCH v2 1/2] daemon: add split_key_value_strings helper
...229,19 @@ let unix_canonical_path path =
> > let path = String.nsplit "/" path in
> > let path = List.filter ((<>) "") path in
> > (if is_absolute then "/" else "") ^ String.concat "/" path
> > +
> > +let simple_unquote s =
> > + let n = String.length s in
> > + if n >= 2 &&
> > + ((s.[0] = '"' && s.[n-1] = '"') || (s.[0] = '\'' && s.[n-1] = '\'')) then
> > + String.sub s 1 (n-2)
> > + else
> >...
2017 Oct 16
3
[PATCH v3 0/2] daemon: add and use parse_key_value_strings helper
Changes from v2 to v3:
- split_key_value_strings renamed to parse_key_value_strings
Changes from v1 to v2:
- split the "simple unquoting" as helper
- pass the unquoting function to split_key_value_strings
- use right unquoting function when applying split_key_value_strings
Pino Toscano (2):
daemon: add split_key_value_strings helper
daemon: use parse_key_value_strings