From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.crosthwaite@xilinx.com, hpoussin@reactos.org, afaerber@suse.de
Subject: [Qemu-devel] [PATCH 1/2] qom: do not register interface "types" in the type table
Date: Tue, 3 Dec 2013 16:41:59 +0100 [thread overview]
Message-ID: <1386085320-12965-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1386085320-12965-1-git-send-email-pbonzini@redhat.com>
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 <pbonzini@redhat.com>
---
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
next prev parent reply other threads:[~2013-12-03 15:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 15:41 [Qemu-devel] [PATCH 0/2] qom: fix registration of QOM interfaces Paolo Bonzini
2013-12-03 15:41 ` Paolo Bonzini [this message]
2013-12-03 15:42 ` [Qemu-devel] [PATCH 2/2] qom: detect bad reentrance during object_class_foreach Paolo Bonzini
2013-12-04 5:51 ` Peter Crosthwaite
2013-12-15 21:23 ` Andreas Färber
2013-12-19 11:38 ` Alexey Kardashevskiy
2013-12-20 11:29 ` Andreas Färber
2013-12-20 11:43 ` Alexey Kardashevskiy
2013-12-24 6:49 ` Alexey Kardashevskiy
2013-12-24 11:20 ` Andreas Färber
2013-12-15 21:25 ` [Qemu-devel] [PATCH 0/2] qom: fix registration of QOM interfaces Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386085320-12965-2-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=hpoussin@reactos.org \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).