qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6 07/12] qapi: Detect collisions in C member na


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v6 07/12] qapi: Detect collisions in C member names
Date: Fri, 2 Oct 2015 19:01:01 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

On 10/02/2015 11:11 AM, Markus Armbruster wrote:

>>> Why wrap function c_name() in a method?  Why not simply call the
>>> function?
>>
>> 'self.c_name()' is shorter than 'c_name(self.name)'.  And I already had
>> long lines with that seen[self.c_name()].describe() pattern.
> 
> You could also try a local variable: cnam = c_name(self.name).
> 
>>> It's method in QAPISchemaEntity only because this lets us add special
>>> cases in a neat way.
>>
>> True, but I _did_ mention in the commit message that I did it for less
>> typing.
>>
>> But as to special cases, yes, I have one in mind (although I have not
>> played with it yet).

> 
> I'm afraid I don't have enough context to grok this late on Friday :)

Here's another case I have in mind. Right now, we have special code
littered in qapi-types and qapi-visit to track that the
QAPISchemaObjectTypeMember for simple unions is named 'type' in QMP but
'kind' in C code.  Having member.c_name() return 'kind' would simplify
that code.

So, what I will do for v7 is rework the patches to independently
implement and use member.c_name() (possibly by also creating a special
subclass of QAPISchemaObjectTypeMember), showing how it makes the
clients easier, and then this patch can also make use of that work.

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