From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlKEb-0001hR-7o for qemu-devel@nongnu.org; Fri, 16 May 2014 11:39:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WlKEV-0000mb-43 for qemu-devel@nongnu.org; Fri, 16 May 2014 11:39:45 -0400 Received: from cantor2.suse.de ([195.135.220.15]:59369 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlKEU-0000mO-UP for qemu-devel@nongnu.org; Fri, 16 May 2014 11:39:39 -0400 Message-ID: <53763138.7030101@suse.de> Date: Fri, 16 May 2014 17:39:36 +0200 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1397669978-26339-1-git-send-email-ehabkost@redhat.com> <20140425111246.6ebb47ae@redhat.com> <535A85D8.9040804@suse.de> <20140425140228.46e7d685@redhat.com> <535AACB3.90102@suse.de> <20140425191608.GU3363@otherpad.lan.raisama.net> In-Reply-To: <20140425191608.GU3363@otherpad.lan.raisama.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2] qmp: object-add: Validate class before creating object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Matthew Rosato , Stefan Hajnoczi , Markus Armbruster , qemu-devel@nongnu.org, Luiz Capitulino , Jan Kiszka , Paolo Bonzini , Igor Mammedov Am 25.04.2014 21:16, schrieb Eduardo Habkost: > On Fri, Apr 25, 2014 at 08:42:59PM +0200, Andreas F=E4rber wrote: >> Am 25.04.2014 20:02, schrieb Luiz Capitulino: >>> On Fri, 25 Apr 2014 17:57:12 +0200 >>> Andreas F=E4rber wrote: >>>> Am 25.04.2014 17:12, schrieb Luiz Capitulino: >>>>> On Wed, 16 Apr 2014 14:39:38 -0300 >>>>> Eduardo Habkost 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 thin= k >>> 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= . >=20 > 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 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg