From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vns7E-0005ki-P9 for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:42:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vns76-0000qA-QA for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:42:24 -0500 Received: from mail-qc0-x22d.google.com ([2607:f8b0:400d:c01::22d]:34798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vns76-0000q6-MK for qemu-devel@nongnu.org; Tue, 03 Dec 2013 10:42:16 -0500 Received: by mail-qc0-f173.google.com with SMTP id m20so878308qcx.32 for ; Tue, 03 Dec 2013 07:42:16 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 3 Dec 2013 16:41:59 +0100 Message-Id: <1386085320-12965-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1386085320-12965-1-git-send-email-pbonzini@redhat.com> References: <1386085320-12965-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 1/2] qom: do not register interface "types" in the type table List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.crosthwaite@xilinx.com, hpoussin@reactos.org, afaerber@suse.de There should be no need to look them up nor enumerate the interface "types", whose "classes" are really just vtables. Just create the types and add them to the interface list of the parent type. Signed-off-by: Paolo Bonzini --- qom/object.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/qom/object.c b/qom/object.c index fc19cf6..3a43186 100644 --- a/qom/object.c +++ b/qom/object.c @@ -88,7 +88,7 @@ static TypeImpl *type_table_lookup(const char *name) return g_hash_table_lookup(type_table_get(), name); } -static TypeImpl *type_register_internal(const TypeInfo *info) +static TypeImpl *type_new(const TypeInfo *info) { TypeImpl *ti = g_malloc0(sizeof(*ti)); int i; @@ -122,8 +122,15 @@ static TypeImpl *type_register_internal(const TypeInfo *info) } ti->num_interfaces = i; - type_table_add(ti); + return ti; +} +static TypeImpl *type_register_internal(const TypeInfo *info) +{ + TypeImpl *ti; + ti = type_new(info); + + type_table_add(ti); return ti; } @@ -216,7 +223,7 @@ static void type_initialize_interface(TypeImpl *ti, const char *parent) info.name = g_strdup_printf("%s::%s", ti->name, info.parent); info.abstract = true; - iface_impl = type_register(&info); + iface_impl = type_new(&info); type_initialize(iface_impl); g_free((char *)info.name); -- 1.8.4.2