On Wed, Aug 22, 2018 at 03:18:31PM +0100, Richard W.M. Jones wrote:
On Wed, Aug 22, 2018 at 01:20:55PM +0200, Pino Toscano wrote:
> On Monday, 20 August 2018 18:02:06 CEST Richard W.M. Jones wrote:
> > - } else
> > - rv = Val_none;
> > + }
> > + 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 guestfs_impl_disk_has_backing_file).
Can you explain more about what a "null" JSON document looks like?
Oh I see, it's actually a special value.
I think I can add this. I've pushed patches 1-3.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org