From: "Andreas Färber" <afaerber@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Matthew Rosato <mjrosato@linux.vnet.ibm.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>,
Jan Kiszka <jan.kiszka@web.de>,
Paolo Bonzini <pbonzini@redhat.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] qmp: object-add: Validate class before creating object
Date: Fri, 16 May 2014 17:39:36 +0200 [thread overview]
Message-ID: <53763138.7030101@suse.de> (raw)
In-Reply-To: <20140425191608.GU3363@otherpad.lan.raisama.net>
Am 25.04.2014 21:16, schrieb Eduardo Habkost:
> On Fri, Apr 25, 2014 at 08:42:59PM +0200, Andreas Färber wrote:
>> Am 25.04.2014 20:02, schrieb Luiz Capitulino:
>>> On Fri, 25 Apr 2014 17:57:12 +0200
>>> Andreas Färber <afaerber@suse.de> wrote:
>>>> Am 25.04.2014 17:12, schrieb Luiz Capitulino:
>>>>> On Wed, 16 Apr 2014 14:39:38 -0300
>>>>> Eduardo Habkost <ehabkost@redhat.com> wrote:
>>>>>
>>>>>> diff --git a/qmp.c b/qmp.c
>>>>>> index 87a28f7..9a93ab1 100644
>>>>>> --- a/qmp.c
>>>>>> +++ b/qmp.c
>>>>>> @@ -540,14 +540,27 @@ void object_add(const char *type, const char *id, const QDict *qdict,
>>>>>> Visitor *v, Error **errp)
>>>>>> {
>>>>>> Object *obj;
>>>>>> + ObjectClass *klass;
>>>>
>>>> Luiz, can you rename klass to oc please?
>>>
>>> My pull request is almost ready (finishing last few tests), so I think
>>> it's a bit late for a style change.
>>
>> Then either one of you please follow-up with a fix before you forget.
>> I've been asked to change patches that way, so I expect others do, too.
>
> Could you explain why this is a bug? The patch matches the existing
> style in qmp.c, and if I grep the whole tree I see 482 matches for
> 'ObjectClass *klass' and 165 for 'ObjectClass *oc'.
Simple explanation for the numbers: "klass" was introduced through
Anthony's Python-automated qdev -> QOM conversion, because C++ reserves
"class". Then when I started making use of QOM for CPUs I was asked to
change my copied "klass" to "oc", with the argument that "klass" is a
deliberate misspelling and that we already used dc for DeviceClass, etc.
Therefore I expect others to update their patches to the new style, too.
ObjectClass *oc
#define MY_CLASS(class) # or MY_CLASS(cls) -- not forbidden in macros
Just like DO_UPCAST() and other pre-QOM macros, the only remedy to avoid
bad copy&paste will be to pass over the source tree and fix it
consistently. No time for that myself now, maybe a GSoC/OPW task?
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
parent reply other threads:[~2014-05-16 15:39 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20140425191608.GU3363@otherpad.lan.raisama.net>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53763138.7030101@suse.de \
--to=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=jan.kiszka@web.de \
--cc=lcapitulino@redhat.com \
--cc=mjrosato@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).