[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: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit() |
Date: |
Wed, 13 Sep 2017 10:08:10 -0400 (EDT) |
----- 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.
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc. +1-919-301-3266
> Virtualization: qemu.org | libvirt.org
>
>
- [Qemu-devel] [PATCH v3 00/50] Hi,, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 03/50] qapi2texi: minor python code simplification, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 02/50] qapi: generate a literal qobject for introspection, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit(), Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 04/50] qapi: add 'if' to top-level expressions, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 05/50] qapi: add tests for invalid 'if', Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 07/50] qapi: add 'ifcond' to visitor methods, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 06/50] qapi: pass 'if' condition into QAPISchemaEntity objects, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 08/50] qapi: mcgen() shouldn't indent # lines, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 10/50] qapi-introspect: modify to_qlit() to append ', ' on level > 0, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 11/50] qapi-introspect: modify to_qlit() to generate #if code, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 09/50] qapi: add #if/#endif helpers, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 12/50] qapi-introspect: add preprocessor conditions to generated QLit, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 13/50] qapi-commands: add #if conditions to commands, Marc-André Lureau, 2017/09/11