From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqYDV-00037K-7s for qemu-devel@nongnu.org; Tue, 10 Dec 2013 20:04:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqYDP-0008PC-LO for qemu-devel@nongnu.org; Tue, 10 Dec 2013 20:03:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:31806) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqYDP-0008P7-CE for qemu-devel@nongnu.org; Tue, 10 Dec 2013 20:03:51 -0500 From: Igor Mammedov Date: Wed, 11 Dec 2013 02:01:16 +0100 Message-Id: <1386723686-26831-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1386723686-26831-1-git-send-email-imammedo@redhat.com> References: <1386723686-26831-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH 01/11] 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: kwolf@redhat.com, peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, ehabkost@redhat.com, mst@redhat.com, marcel.a@redhat.com, blauwirbel@gmail.com, alex.williamson@redhat.com, kraxel@redhat.com, anthony@codemonkey.ws, pbonzini@redhat.com, dkoch@verizon.co, afaerber@suse.de From: Paolo Bonzini 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 Signed-off-by: Igor Mammedov --- qom/object.c | 13 ++++++++++--- 1 files 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.7.1