From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58850) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJjzN-0001lt-Sh for qemu-devel@nongnu.org; Mon, 27 Jul 2015 11:06:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJjzJ-0003SX-64 for qemu-devel@nongnu.org; Mon, 27 Jul 2015 11:06:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJjzJ-0003ST-0u for qemu-devel@nongnu.org; Mon, 27 Jul 2015 11:06:45 -0400 References: <507c11db2c97eef33de0e4f7168076d5c39f0867.1436866326.git.p.fedin@samsung.com> <87r3ntzra9.fsf@blackfin.pond.sub.org> <003201d0c879$8fced800$af6c8800$@samsung.com> <55B646CD.8010808@suse.de> From: Paolo Bonzini Message-ID: <55B64900.6020008@redhat.com> Date: Mon, 27 Jul 2015 17:06:40 +0200 MIME-Version: 1.0 In-Reply-To: <55B646CD.8010808@suse.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 2/2] QOM: object_property_add() performance improvement List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Andreas_F=c3=a4rber?= , Pavel Fedin , 'Markus Armbruster' Cc: 'Peter Crosthwaite' , qemu-devel@nongnu.org On 27/07/2015 16:57, Andreas F=C3=A4rber wrote: >> > I am absolutely fine with absolutely anything. Suggest what you lik= e and i'll change it. > Paolo suggested ...-count on #qemu, but I would prefer ...-max or so, a= s > the number could differ when some property gets deleted. Yes, I agree -max is better. I'm just asking myself whether this is really necessary. Is the automagic [*] really needed in this case? Can it just do: diff --git a/hw/core/qdev.c b/hw/core/qdev.c index b2f404a..19bfee1 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -415,19 +415,19 @@ static NamedGPIOList *qdev_get_named_gpio_list(Devi= ceState *dev, void qdev_init_gpio_in_named(DeviceState *dev, qemu_irq_handler handler, const char *name, int n) { - int i; + int i, j; NamedGPIOList *gpio_list =3D qdev_get_named_gpio_list(dev, name); - char *propname =3D g_strdup_printf("%s[*]", name ? name : "unnamed-g= pio-in"); =20 assert(gpio_list->num_out =3D=3D 0 || !name); gpio_list->in =3D qemu_extend_irqs(gpio_list->in, gpio_list->num_in,= handler, dev, n); =20 for (i =3D gpio_list->num_in; i < gpio_list->num_in + n; i++) { + char *propname =3D g_strdup_printf("%s[%d]", name ? name : "unna= med-gpio-in", j++); object_property_add_child(OBJECT(dev), propname, OBJECT(gpio_list->in[i]), &error_abort= ); + g_free(propname); } - g_free(propname); =20 gpio_list->num_in +=3D n; } ? Paolo > On the other hand, since this is not a user-added property, using a > reserved character such as '#' would avoid clashes with user-added > properties, as long as tools handle accessing that property okay.