On 08/01/2017 12:48 AM, Markus Armbruster wrote:

>> Hmm. What if we assert that qobject_from_jsonf() can never fail halfway
>> through?


> I don't buy the "primarily for the testsuite argument".  It's for
> whatever finds it useful.  Safer than formatting the JSON text (no JSON
> injection accidents), much easier to read than building a QObject to
> pass to the JSON output visitor.
> 
> I'd be willing to buy a "passing syntactically incorrect JSON to
> qobject_from_jsonf() is a programming error" argument.  Assertion
> failure is the appropriate way to deal with programming errors.  Needs
> to be spelled out in function contracts, of course, starting with
> json_parser_parse_err(), which (scandalously!) has none.

In fact, qobject_from_jsonf() _does_ assert if it is handed ill-formed
input.  Only qobject_from_jsonv() does not.  That will be fixed in my
next series, along with some documentation comments.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to