From patchwork Wed Dec 11 10:22:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 299917 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BFFF32C0096 for ; Wed, 11 Dec 2013 21:23:43 +1100 (EST) Received: from localhost ([::1]:54836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqgxB-0001cN-3u for incoming@patchwork.ozlabs.org; Wed, 11 Dec 2013 05:23:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqgwO-0001Ys-SY for qemu-devel@nongnu.org; Wed, 11 Dec 2013 05:23:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqgwF-0001DX-PE for qemu-devel@nongnu.org; Wed, 11 Dec 2013 05:22:52 -0500 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:47270) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqgwF-0001CH-1f for qemu-devel@nongnu.org; Wed, 11 Dec 2013 05:22:43 -0500 Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Dec 2013 20:22:40 +1000 Received: from d23dlp02.au.ibm.com (202.81.31.213) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 11 Dec 2013 20:22:37 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 664C12BB0059; Wed, 11 Dec 2013 21:22:36 +1100 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rBBAMFnM4456840; Wed, 11 Dec 2013 21:22:23 +1100 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rBBAMRkN017344; Wed, 11 Dec 2013 21:22:27 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.190.163.12]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id rBBAMR42017339; Wed, 11 Dec 2013 21:22:27 +1100 Received: from bran.ozlabs.ibm.com (haven.au.ibm.com [9.190.164.82]) by ozlabs.au.ibm.com (Postfix) with ESMTP id 011BBA0111; Wed, 11 Dec 2013 21:22:27 +1100 (EST) Received: from ka1.ozlabs.ibm.com (ka1.ozlabs.ibm.com [10.61.145.11]) by bran.ozlabs.ibm.com (Postfix) with ESMTP id 1788016AAC9; Wed, 11 Dec 2013 21:22:25 +1100 (EST) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Wed, 11 Dec 2013 21:22:14 +1100 Message-Id: <1386757341-12154-2-git-send-email-aik@ozlabs.ru> X-Mailer: git-send-email 1.8.4.rc4 In-Reply-To: <1386757341-12154-1-git-send-email-aik@ozlabs.ru> References: <1386757341-12154-1-git-send-email-aik@ozlabs.ru> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13121110-5140-0000-0000-0000044922E1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 202.81.31.141 Cc: aik@ozlabs.ru, Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf Subject: [Qemu-devel] [PATCH v4 1/8] qom: do not register interface "types" in the type table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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: Alexey Kardashevskiy --- 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; + 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);