qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()
Date: Wed, 06 Dec 2017 15:37:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Marc-André Lureau <address@hidden> writes:

> ----- Original Message -----
>> On 09/11/2017 06:05 AM, Marc-André Lureau wrote:
>> > Instanciate a QObject* form a literal QLitObject.
>> 
>> s/Instanciate/Instantiate/
>> s/form/from/
>
> thanks
>
>> 
>> > 
>> > Signed-off-by: Marc-André Lureau <address@hidden>
>> > ---
>> >  include/qapi/qmp/qlit.h |  2 ++
>> >  qobject/qlit.c          | 36 ++++++++++++++++++++++++++++++++++++
>> >  tests/check-qlit.c      | 26 ++++++++++++++++++++++++++
>> >  3 files changed, 64 insertions(+)
>> 
>> > +QObject *qobject_from_qlit(const QLitObject *qlit)
>> > +{
>> > +    switch (qlit->type) {
>> > +    case QTYPE_QNULL:
>> > +        return QOBJECT(qnull());
>> > +    case QTYPE_QNUM:
>> > +        return QOBJECT(qnum_from_int(qlit->value.qnum));
>> 
>> Is this going to work for all QNum values?
>> 
>> > +++ b/tests/check-qlit.c
>> > @@ -64,11 +64,37 @@ static void qlit_equal_qobject_test(void)
>> >      qobject_decref(qobj);
>> >  }
>> >  
>> > +static void qobject_from_qlit_test(void)
>> > +{
>> > +    QObject *obj, *qobj = qobject_from_qlit(&qlit);
>> > +    QDict *qdict;
>> > +    QList *bee;
>> > +
>> > +    qdict = qobject_to_qdict(qobj);
>> > +    g_assert_cmpint(qdict_get_int(qdict, "foo"), ==, 42);
>> > +    g_assert_cmpstr(qdict_get_str(qdict, "bar"), ==, "hello world");
>> > +    g_assert(qobject_type(qdict_get(qdict, "baz")) == QTYPE_QNULL);
>> 
>> Related to my question above - you pass because there are no floating
>> point values in qlit.  Is that something we want supported?
>
> Markus had some remarks about it when reviewing #define QLIT_QNUM. Only i64 
> are supported at this point, so it's left for whoever requires it in the 
> future.

Yes, QLitObject only supports int64_t for now.  uint64_t and double
aren't implemented.

By the way, shouldn't QLitObject member type be QType instead of int?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]