[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v16 02/24] qapi: Guarantee NULL obj on input vis
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v16 02/24] qapi: Guarantee NULL obj on input visitor callback error |
Date: |
Fri, 29 Apr 2016 14:59:10 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 04/29/2016 06:10 AM, Eric Blake wrote:
>> On 04/29/2016 02:28 AM, Markus Armbruster wrote:
>>> Eric Blake <address@hidden> writes:
>>>
>>>> Our existing input visitors were not very consistent on errors
>>>> in a function taking 'TYPE **obj' (that is, start_struct(),
>>>> start_alternate(), type_str(), and type_any(). next_list() is
>>>> similar, except that since commit 08f9541, it can't fail).
>>>
>>> Multiple sentences in a parenthesis, ugh :)
>>>
>>> Our existing input visitors were not very consistent on errors in a
>>> function taking 'TYPE **obj'. These are start_struct(),
>>> start_alternate(), type_str(), and type_any(). next_list() is
>>> similar, but can't fail (see commit since 08f9541).
>>>
>>> Can touch up on commit.
>>>
>>
>> Yes, sounds better.
>
> Spoke too soon: "see commit since 08f9541" is too wordy, should be
> either "see commit 08f9541" or "since commit 08f9541"
I'm terribly prone to leaving unwanted words behind when tinkering with
a sentence... Thanks!
>>>> @@ -51,10 +57,16 @@ void visit_start_alternate(Visitor *v, const char
>>>> *name,
>>>> GenericAlternate **obj, size_t size,
>>>> bool promote_int, Error **errp)
>>>> {
>>>> + Error *err = NULL;
>>>> +
>>>> assert(obj && size >= sizeof(GenericAlternate));
>>>> if (v->start_alternate) {
>>>> - v->start_alternate(v, name, obj, size, promote_int, errp);
>>>> + v->start_alternate(v, name, obj, size, promote_int, &err);
>>>> }
>>>> + if (v->type == VISITOR_INPUT) {
>>>> + assert(!err != !*obj);
>>>
>>> Could assert(v->start_alternate && !err != !*obj), to preempt "what if
>>> !v->start_alternate" worries. If you like that, I can do it on commit.
>>
>> Can't hurt :)
Done.
[Qemu-devel] [PATCH v16 17/24] qmp: Add qmp_output_visitor_reset(), Eric Blake, 2016/04/28
[Qemu-devel] [PATCH v16 05/24] qapi: Consolidate QMP input visitor creation, Eric Blake, 2016/04/28
[Qemu-devel] [PATCH v16 09/24] qom: Wrap prop visit in visit_start_struct, Eric Blake, 2016/04/28
[Qemu-devel] [PATCH v16 11/24] qmp-input: Refactor when list is advanced, Eric Blake, 2016/04/28
[Qemu-devel] [PATCH v16 07/24] qmp-input: Don't consume input when checking has_member, Eric Blake, 2016/04/28
[Qemu-devel] [PATCH v16 10/24] qmp-input: Require struct push to visit members of top dict, Eric Blake, 2016/04/28
[Qemu-devel] [PATCH v16 01/24] qapi-visit: Add visitor.type classification, Eric Blake, 2016/04/28