Displaying 5 results from an estimated 5 matches for "json_string_tag".
2018 Aug 22
3
Re: [PATCH 4/4] mltools: JSON: unify JSON_parser type with JSON.json_t.
...> + else {
> + /* Previously we had a special JSON_parser_null value we could
> + * use here, making the returned type (sort of) an option.
> + * This is a best effort which is better than crashing /
> + * throwing an error.
> + */
> + rv = caml_alloc (1, JSON_STRING_TAG);
> + v = caml_copy_string ("");
> + Store_field (rv, 0, v);
> + }
NACK, this is not correct. null is a proper type of value in JSON, and
thus JSON.json_t must represent it as well.
This is even used in other parts, for example the check of backing
files of disks (see g...
2018 Aug 20
0
[PATCH 4/4] mltools: JSON: unify JSON_parser type with JSON.json_t.
...diff --git a/common/mltools/JSON_parser-c.c b/common/mltools/JSON_parser-c.c
index 32432dc5b..dce9f6a15 100644
--- a/common/mltools/JSON_parser-c.c
+++ b/common/mltools/JSON_parser-c.c
@@ -28,7 +28,12 @@
#include <stdio.h>
#include <string.h>
-#define Val_none (Val_int (0))
+#define JSON_STRING_TAG 0
+#define JSON_INT_TAG 1
+#define JSON_FLOAT_TAG 2
+#define JSON_BOOL_TAG 3
+#define JSON_LIST_TAG 4
+#define JSON_DICT_TAG 5
value virt_builder_json_parser_tree_parse (value stringv);
@@ -36,60 +41,87 @@ static value
convert_json_t (json_t *val, int level)
{
CAMLparam0 ();
-...
2018 Aug 22
0
Re: [PATCH 4/4] mltools: JSON: unify JSON_parser type with JSON.json_t.
.../* Previously we had a special JSON_parser_null value we could
> > + * use here, making the returned type (sort of) an option.
> > + * This is a best effort which is better than crashing /
> > + * throwing an error.
> > + */
> > + rv = caml_alloc (1, JSON_STRING_TAG);
> > + v = caml_copy_string ("");
> > + Store_field (rv, 0, v);
> > + }
>
> NACK, this is not correct. null is a proper type of value in JSON, and
> thus JSON.json_t must represent it as well.
>
> This is even used in other parts, for example th...
2018 Aug 22
3
[PATCH v2 0/2] mltools: JSON: unify JSON & JSON parser.
v2:
- Added back the null value.
- Reran the tests.
Rich.
2018 Aug 20
6
[PATCH 0/4] mltools: JSON unification
An evolution of:
https://www.redhat.com/archives/libguestfs/2018-August/msg00155.html