|
From: | Eric Blake |
Subject: | Re: [Qemu-devel] [PATCH v8 03/23] qobject: introduce qobject_get_try_str() |
Date: | Fri, 9 Mar 2018 14:10:14 -0600 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 03/09/2018 02:59 AM, Peter Xu wrote:
A quick way to fetch string from qobject when it's a QString. Reviewed-by: Fam Zheng <address@hidden> Reviewed-by: Stefan Hajnoczi <address@hidden> Signed-off-by: Peter Xu <address@hidden> --- include/qapi/qmp/qstring.h | 1 + qobject/qstring.c | 11 +++++++++++ 2 files changed, 12 insertions(+)
+++ b/qobject/qstring.c @@ -137,6 +137,17 @@ const char *qstring_get_try_str(const QString *qstring) return qstring ? qstring_get_str(qstring) : NULL; }+/**+ * qobject_get_try_str(): Return a pointer to the corresponding string + * + * NOTE: the string will only be returned if the object is valid, and + * its type is QString, otherwise NULL is returned. + */ +const char *qobject_get_try_str(const QObject *qstring) +{ + return qstring_get_try_str(qobject_to_qstring(qstring));
Conflicts with Max's refactoring to a qobject_to() macro. https://lists.gnu.org/archive/html/qemu-devel/2018-02/msg06230.html Whoever lands first gets to watch the other (or the maintainer) rebase ;) Reviewed-by: Eric Blake <address@hidden> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |