[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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

Attachment: signature.asc
Description: This is a digitally signed message part.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]