[Libguestfs] [PATCH 4/4] mltools: JSON: unify JSON_parser type with JSON.json_t.

Pino Toscano ptoscano at redhat.com
Wed Aug 22 11:20:55 UTC 2018


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).

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20180822/aa950dd0/attachment.sig>


More information about the Libguestfs mailing list