qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 04/17] qapi: merge QInt and QFloat in QNum


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 04/17] qapi: merge QInt and QFloat in QNum
Date: Thu, 11 May 2017 10:09:37 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 05/11/2017 09:29 AM, Markus Armbruster wrote:
> Marc-André Lureau <address@hidden> writes:
> 
>> We would like to use a same QObject type to represent numbers, whether
>> they are int, uint, or floats. getters will allow some compatibility
> 
> Please start your sentence with a capital letter ...
> 
>> between the various types if the number fits other representations
> 
> ... and end them with a period.
> 

>> +++ b/block/qapi.c
>> @@ -595,9 +595,11 @@ static void dump_qobject(fprintf_function func_fprintf, 
>> void *f,
>>                           int comp_indent, QObject *obj)
>>  {
>>      switch (qobject_type(obj)) {
>> -        case QTYPE_QINT: {
>> -            QInt *value = qobject_to_qint(obj);
>> -            func_fprintf(f, "%" PRId64, qint_get_int(value));
>> +        case QTYPE_QNUM: {
>> +            QNum *value = qobject_to_qnum(obj);
>> +            char *tmp = qnum_to_string(value);
>> +            func_fprintf(f, "%s", tmp);
>> +            g_free(tmp);
>>              break;
>>          }
>>          case QTYPE_QSTRING: {
> 
> Becomes a bit awkward due to the dynamically allocated buffer.  Let's
> ignore that for now.
> 
> Aside: I don't like that the block layer has its own dump_qobject().

I should really revive my patches for a QAPI JSON output visitor.

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

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