[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends |
Date: |
Tue, 1 Aug 2017 09:13:30 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
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
signature.asc
Description: OpenPGP digital signature