From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, afaerber@suse.de, anthony@codemonkey.ws
Subject: [Qemu-devel] [PATCH RFC 1/2] qom: Give type_get_by_name() external linkage
Date: Thu, 24 May 2012 13:43:03 +0200 [thread overview]
Message-ID: <1337859784-24097-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1337859784-24097-1-git-send-email-armbru@redhat.com>
Following the type_register() precedence, the definition returns
"TypeImpl *", while the declaration returns "Type". Fine, because the
latter is actually a typedef for the former.
For the record, I don't think this typedef'ing away the "*" is a good
idea. It only complicates matters. When I see
TypeImpl *type_get_by_name(const char *name)
it's immediately obvious that the value has pointer semantics, and a
null pointer must be the error value.
Moreover, it's unusual in QEMU code.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
include/qemu/object.h | 8 ++++++++
qom/object.c | 2 +-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/include/qemu/object.h b/include/qemu/object.h
index d93b772..3648462 100644
--- a/include/qemu/object.h
+++ b/include/qemu/object.h
@@ -535,6 +535,14 @@ Type type_register_static(const TypeInfo *info);
Type type_register(const TypeInfo *info);
/**
+ * type_get_by_name:
+ * @name: The name of the type
+ *
+ * Returns: The #Type with that name if it exists, else NULL.
+ */
+Type type_get_by_name(const char *name);
+
+/**
* object_class_dynamic_cast_assert:
* @klass: The #ObjectClass to attempt to cast.
* @typename: The QOM typename of the class to cast to.
diff --git a/qom/object.c b/qom/object.c
index 6f839ad..94ea0f9 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -140,7 +140,7 @@ TypeImpl *type_register_static(const TypeInfo *info)
return type_register(info);
}
-static TypeImpl *type_get_by_name(const char *name)
+TypeImpl *type_get_by_name(const char *name)
{
if (name == NULL) {
return NULL;
--
1.7.6.5
next prev parent reply other threads:[~2012-05-24 11:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-24 11:43 [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new Markus Armbruster
2012-05-24 11:43 ` Markus Armbruster [this message]
2012-05-24 11:43 ` [Qemu-devel] [PATCH RFC 2/2] qmp: New " Markus Armbruster
2012-05-24 11:51 ` Paolo Bonzini
2012-05-24 12:58 ` Anthony Liguori
2012-05-24 13:01 ` Andreas Färber
2012-05-24 13:44 ` Paolo Bonzini
2012-05-24 14:12 ` Anthony Liguori
2012-05-24 13:04 ` Anthony Liguori
2012-05-24 13:48 ` Igor Mammedov
2012-05-24 14:01 ` Andreas Färber
2012-05-24 14:07 ` Anthony Liguori
2012-05-24 15:33 ` Igor Mammedov
2012-05-24 14:04 ` Anthony Liguori
2012-05-24 14:24 ` Markus Armbruster
2012-05-24 15:15 ` Michael Roth
2012-05-24 12:32 ` [Qemu-devel] [PATCH RFC 0/2] QMP " Andreas Färber
2012-05-24 13:06 ` Anthony Liguori
2012-05-24 13:18 ` Peter Maydell
2012-05-24 14:10 ` Anthony Liguori
2012-05-24 14:23 ` Peter Maydell
2012-05-24 14:35 ` Anthony Liguori
2012-05-24 14:52 ` Peter Maydell
2012-05-24 14:08 ` Markus Armbruster
2012-05-24 14:31 ` Andreas Färber
2012-05-24 14:48 ` Markus Armbruster
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=1337859784-24097-2-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=pbonzini@redhat.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).