On 01/23/2014 07:46 AM, Amos Kong wrote:
> Signed-off-by: Amos Kong <ak...@redhat.com>
> ---
>  include/qapi/qmp/qstring.h |  1 +
>  qobject/qstring.c          | 19 +++++++++++++++++++
>  2 files changed, 20 insertions(+)

Is there anything you can add to the testsuite to validate that this
works as expected?  I'm not quite sure if check-qdict.c is the best fit,
but it's the sort of test I have in mind.

> +++ b/qobject/qstring.c
> @@ -135,6 +135,25 @@ const char *qstring_get_str(const QString *qstring)
>  }
>  
>  /**
> + * qobject_to_str(): Convert a QObject to QString and return
> + * a pointer to the stored string
> + */
> +const char *qobject_get_str(const QObject *data)
> +{
> +    QString *qstr;
> +
> +    if (!data) {
> +        return NULL;
> +    }
> +    qstr = qobject_to_qstring(data);
> +    if (qstr) {
> +        return qstring_get_str(qstr);
> +    } else {
> +        return NULL;
> +    }

It looks like this is shorthand for getting at the string value of a
QTYPE_QSTRING object.  I'm not sure how you were planning on using it,
or if it saves much code.  This is where you could use your commit
message to explain why this shorthand will be useful.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to