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?
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v