qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 26/27] qapi: Remove dead visitor code


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v9 26/27] qapi: Remove dead visitor code
Date: Tue, 10 Nov 2015 23:13:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 11/05/2015 12:05 PM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> Commit cbc95538 removed unused start_handle() and end_handle(),
>> but forgot got remove their declarations.
>>
>> Commit 4e27e819 introduced optional visitor callbacks for all
>> sorts of int types, but except for type_uint64 and type_size,
>> none of them have ever been supplied (the generic implementation
>> based on using type_int then bounds-checking works just fine).
>> In the interest of simplicity, it's easier to make the visitor
>> callback interface not have to worry about the other sizes.
>>
>> Signed-off-by: Eric Blake <address@hidden>
>>

> | +
> | +    /* Only required to visit uint64 differently than (*type_int)().  */
> 
> If you don't supply it, what happens for uint64_t values that aren't
> representable as int64_t?
> 
> | +    void (*type_uint64)(Visitor *v, uint64_t *obj, const char *name,

> Answering my "what happens" question:
> 
> * Input visitor
> 
>   If your type_int() accepts large positive input values and casts them
>   to the corresponding large negative value, *obj = value will cast them
>   right back, and the sloppiness cancels out.
> 
>   If it rejects them, they stay rejected.
> 
> * Output visitor
> 
>   You'll output large positive values as the corresponding large
>   negative value.
> 
> I doubt not defining this makes much sense.  Do we have such visitors?

Yes (qapi-dealloc-visitor.c gets away with it, but qmp-input-visitor.c,
qmp-output-visitor.c, string-input-visitor.c, and
string-output-visitor.c are all afflicted). But we shouldn't. For my
next spin of this patch, I'll first add another patch that guarantees
that all visitors have both signed and unsigned int handled correctly.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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