From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJk1t-0003Rl-7w for qemu-devel@nongnu.org; Mon, 27 Jul 2015 11:09:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJk1q-0005bt-05 for qemu-devel@nongnu.org; Mon, 27 Jul 2015 11:09:25 -0400 Received: from mail-wi0-x22e.google.com ([2a00:1450:400c:c05::22e]:36940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJk1p-0005bM-O9 for qemu-devel@nongnu.org; Mon, 27 Jul 2015 11:09:21 -0400 Received: by wibud3 with SMTP id ud3so120380433wib.0 for ; Mon, 27 Jul 2015 08:09:21 -0700 (PDT) Sender: Paolo Bonzini References: <507c11db2c97eef33de0e4f7168076d5c39f0867.1436866326.git.p.fedin@samsung.com> <87r3ntzra9.fsf@blackfin.pond.sub.org> <003201d0c879$8fced800$af6c8800$@samsung.com> <55B646CD.8010808@suse.de> <55B64900.6020008@redhat.com> From: Paolo Bonzini Message-ID: <55B6499F.407@redhat.com> Date: Mon, 27 Jul 2015 17:09:19 +0200 MIME-Version: 1.0 In-Reply-To: <55B64900.6020008@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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 17:06, Paolo Bonzini wrote: > > > On 27/07/2015 16:57, Andreas Färber wrote: >>>> I am absolutely fine with absolutely anything. Suggest what you like and i'll change it. >> Paolo suggested ...-count on #qemu, but I would prefer ...-max or so, as >> 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(DeviceState *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 = qdev_get_named_gpio_list(dev, name); > - char *propname = g_strdup_printf("%s[*]", name ? name : "unnamed-gpio-in"); > > assert(gpio_list->num_out == 0 || !name); > gpio_list->in = qemu_extend_irqs(gpio_list->in, gpio_list->num_in, handler, > dev, n); > > for (i = gpio_list->num_in; i < gpio_list->num_in + n; i++) { > + char *propname = g_strdup_printf("%s[%d]", name ? name : "unnamed-gpio-in", j++); > object_property_add_child(OBJECT(dev), propname, > OBJECT(gpio_list->in[i]), &error_abort); > + g_free(propname); > } > - g_free(propname); > > gpio_list->num_in += n; > } > > ? ... and the same in qdev_init_gpio_out_named. Paolo