qemu-devel
[Top][All Lists]
Advanced

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]