[{"id":1767906,"web_url":"http://patchwork.ozlabs.org/comment/1767906/","msgid":"<60e9ce8a-9473-cf55-5429-f70902bc59c2@redhat.com>","list_archive_url":null,"date":"2017-09-13T13:51:28","subject":"Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/11/2017 06:05 AM, Marc-André Lureau wrote:\n> Instanciate a QObject* form a literal QLitObject.\n\ns/Instanciate/Instantiate/\ns/form/from/\n\n> \n> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n> ---\n>  include/qapi/qmp/qlit.h |  2 ++\n>  qobject/qlit.c          | 36 ++++++++++++++++++++++++++++++++++++\n>  tests/check-qlit.c      | 26 ++++++++++++++++++++++++++\n>  3 files changed, 64 insertions(+)\n\n> +QObject *qobject_from_qlit(const QLitObject *qlit)\n> +{\n> +    switch (qlit->type) {\n> +    case QTYPE_QNULL:\n> +        return QOBJECT(qnull());\n> +    case QTYPE_QNUM:\n> +        return QOBJECT(qnum_from_int(qlit->value.qnum));\n\nIs this going to work for all QNum values?\n\n> +++ b/tests/check-qlit.c\n> @@ -64,11 +64,37 @@ static void qlit_equal_qobject_test(void)\n>      qobject_decref(qobj);\n>  }\n>  \n> +static void qobject_from_qlit_test(void)\n> +{\n> +    QObject *obj, *qobj = qobject_from_qlit(&qlit);\n> +    QDict *qdict;\n> +    QList *bee;\n> +\n> +    qdict = qobject_to_qdict(qobj);\n> +    g_assert_cmpint(qdict_get_int(qdict, \"foo\"), ==, 42);\n> +    g_assert_cmpstr(qdict_get_str(qdict, \"bar\"), ==, \"hello world\");\n> +    g_assert(qobject_type(qdict_get(qdict, \"baz\")) == QTYPE_QNULL);\n\nRelated to my question above - you pass because there are no floating\npoint values in qlit.  Is that something we want supported?","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xsjl54cMhz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 23:52:01 +1000 (AEST)","from localhost ([::1]:42648 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1ds859-0004lv-Hf\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 09:51:59 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:50833)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1ds84p-0004lb-FU\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 09:51:40 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1ds84k-0006dz-Sf\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 09:51:39 -0400","from mx1.redhat.com ([209.132.183.28]:48562)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>) id 1ds84k-0006cB-K7\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 09:51:34 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id ED10D5F795\n\tfor <qemu-devel@nongnu.org>; Wed, 13 Sep 2017 13:51:31 +0000 (UTC)","from [10.10.120.44] (ovpn-120-44.rdu2.redhat.com [10.10.120.44])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 10AD058829;\n\tWed, 13 Sep 2017 13:51:28 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com ED10D5F795","To":"=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n\tqemu-devel@nongnu.org","References":"<20170911110623.24981-1-marcandre.lureau@redhat.com>\n\t<20170911110623.24981-2-marcandre.lureau@redhat.com>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<60e9ce8a-9473-cf55-5429-f70902bc59c2@redhat.com>","Date":"Wed, 13 Sep 2017 08:51:28 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170911110623.24981-2-marcandre.lureau@redhat.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"CbCUru5K6j0AFFIJDsMAJJcI6XXlcN6Ec\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tWed, 13 Sep 2017 13:51:32 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"armbru@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1767913,"web_url":"http://patchwork.ozlabs.org/comment/1767913/","msgid":"<752107234.14989591.1505311690362.JavaMail.zimbra@redhat.com>","list_archive_url":null,"date":"2017-09-13T14:08:10","subject":"Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()","submitter":{"id":66774,"url":"http://patchwork.ozlabs.org/api/people/66774/","name":"Marc-André Lureau","email":"marcandre.lureau@redhat.com"},"content":"----- Original Message -----\n> On 09/11/2017 06:05 AM, Marc-André Lureau wrote:\n> > Instanciate a QObject* form a literal QLitObject.\n> \n> s/Instanciate/Instantiate/\n> s/form/from/\n\nthanks\n\n> \n> > \n> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n> > ---\n> >  include/qapi/qmp/qlit.h |  2 ++\n> >  qobject/qlit.c          | 36 ++++++++++++++++++++++++++++++++++++\n> >  tests/check-qlit.c      | 26 ++++++++++++++++++++++++++\n> >  3 files changed, 64 insertions(+)\n> \n> > +QObject *qobject_from_qlit(const QLitObject *qlit)\n> > +{\n> > +    switch (qlit->type) {\n> > +    case QTYPE_QNULL:\n> > +        return QOBJECT(qnull());\n> > +    case QTYPE_QNUM:\n> > +        return QOBJECT(qnum_from_int(qlit->value.qnum));\n> \n> Is this going to work for all QNum values?\n> \n> > +++ b/tests/check-qlit.c\n> > @@ -64,11 +64,37 @@ static void qlit_equal_qobject_test(void)\n> >      qobject_decref(qobj);\n> >  }\n> >  \n> > +static void qobject_from_qlit_test(void)\n> > +{\n> > +    QObject *obj, *qobj = qobject_from_qlit(&qlit);\n> > +    QDict *qdict;\n> > +    QList *bee;\n> > +\n> > +    qdict = qobject_to_qdict(qobj);\n> > +    g_assert_cmpint(qdict_get_int(qdict, \"foo\"), ==, 42);\n> > +    g_assert_cmpstr(qdict_get_str(qdict, \"bar\"), ==, \"hello world\");\n> > +    g_assert(qobject_type(qdict_get(qdict, \"baz\")) == QTYPE_QNULL);\n> \n> Related to my question above - you pass because there are no floating\n> point values in qlit.  Is that something we want supported?\n\nMarkus 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.\n\n> \n> --\n> Eric Blake, Principal Software Engineer\n> Red Hat, Inc.           +1-919-301-3266\n> Virtualization:  qemu.org | libvirt.org\n> \n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=mlureau@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xsk6p1vv0z9s78\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 00:09:06 +1000 (AEST)","from localhost ([::1]:42721 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1ds8Lg-0004qr-7d\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 10:09:04 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:57483)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <mlureau@redhat.com>) id 1ds8Kv-0004hA-V6\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 10:08:22 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <mlureau@redhat.com>) id 1ds8Kr-0004O4-VV\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 10:08:17 -0400","from mx1.redhat.com ([209.132.183.28]:59216)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <mlureau@redhat.com>) id 1ds8Kr-0004NC-Pk\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 10:08:13 -0400","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 77BDCC04B924\n\tfor <qemu-devel@nongnu.org>; Wed, 13 Sep 2017 14:08:11 +0000 (UTC)","from colo-mx.corp.redhat.com\n\t(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 6F2895D966;\n\tWed, 13 Sep 2017 14:08:11 +0000 (UTC)","from zmail17.collab.prod.int.phx2.redhat.com\n\t(zmail17.collab.prod.int.phx2.redhat.com [10.5.83.19])\n\tby colo-mx.corp.redhat.com (Postfix) with ESMTP id 674023FACD;\n\tWed, 13 Sep 2017 14:08:11 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 77BDCC04B924","Date":"Wed, 13 Sep 2017 10:08:10 -0400 (EDT)","From":"=?utf-8?q?Marc-Andr=C3=A9?= Lureau <marcandre.lureau@redhat.com>","To":"Eric Blake <eblake@redhat.com>","Message-ID":"<752107234.14989591.1505311690362.JavaMail.zimbra@redhat.com>","In-Reply-To":"<60e9ce8a-9473-cf55-5429-f70902bc59c2@redhat.com>","References":"<20170911110623.24981-1-marcandre.lureau@redhat.com>\n\t<20170911110623.24981-2-marcandre.lureau@redhat.com>\n\t<60e9ce8a-9473-cf55-5429-f70902bc59c2@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","X-Originating-IP":"[10.36.112.12, 10.4.195.2]","Thread-Topic":"qlit: add qobject_from_qlit()","Thread-Index":"lkro655k3Bw7Dm7rO3suM9arhViYvQ==","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.14","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tWed, 13 Sep 2017 14:08:11 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-devel@nongnu.org, armbru@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1816971,"web_url":"http://patchwork.ozlabs.org/comment/1816971/","msgid":"<87shcnzzv8.fsf@dusky.pond.sub.org>","list_archive_url":null,"date":"2017-12-06T14:37:31","subject":"Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()","submitter":{"id":2645,"url":"http://patchwork.ozlabs.org/api/people/2645/","name":"Markus Armbruster","email":"armbru@redhat.com"},"content":"Marc-André Lureau <marcandre.lureau@redhat.com> writes:\n\n> Instanciate a QObject* form a literal QLitObject.\n>\n> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n> ---\n>  include/qapi/qmp/qlit.h |  2 ++\n>  qobject/qlit.c          | 36 ++++++++++++++++++++++++++++++++++++\n>  tests/check-qlit.c      | 26 ++++++++++++++++++++++++++\n>  3 files changed, 64 insertions(+)\n>\n> diff --git a/include/qapi/qmp/qlit.h b/include/qapi/qmp/qlit.h\n> index b18406bce9..56feb25e04 100644\n> --- a/include/qapi/qmp/qlit.h\n> +++ b/include/qapi/qmp/qlit.h\n> @@ -51,4 +51,6 @@ struct QLitDictEntry {\n>  \n>  bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs);\n>  \n> +QObject *qobject_from_qlit(const QLitObject *qlit);\n> +\n>  #endif /* QLIT_H */\n> diff --git a/qobject/qlit.c b/qobject/qlit.c\n> index 3c4882c784..df2ad97d33 100644\n> --- a/qobject/qlit.c\n> +++ b/qobject/qlit.c\n> @@ -82,3 +82,39 @@ bool qlit_equal_qobject(const QLitObject *lhs, const QObject *rhs)\n>  \n>      return false;\n>  }\n> +\n> +QObject *qobject_from_qlit(const QLitObject *qlit)\n> +{\n> +    switch (qlit->type) {\n> +    case QTYPE_QNULL:\n> +        return QOBJECT(qnull());\n> +    case QTYPE_QNUM:\n> +        return QOBJECT(qnum_from_int(qlit->value.qnum));\n> +    case QTYPE_QSTRING:\n> +        return QOBJECT(qstring_from_str(qlit->value.qstr));\n> +    case QTYPE_QDICT: {\n> +        QDict *qdict = qdict_new();\n> +        QLitDictEntry *e;\n> +\n> +        for (e = qlit->value.qdict; e->key; e++) {\n> +            qdict_put_obj(qdict, e->key, qobject_from_qlit(&e->value));\n> +        }\n> +        return QOBJECT(qdict);\n> +    }\n> +    case QTYPE_QLIST: {\n> +        QList *qlist = qlist_new();\n> +        QLitObject *e;\n> +\n> +        for (e = qlit->value.qlist; e->type != QTYPE_NONE; e++) {\n> +            qlist_append_obj(qlist, qobject_from_qlit(e));\n> +        }\n> +        return QOBJECT(qlist);\n> +    }\n> +    case QTYPE_QBOOL:\n> +        return QOBJECT(qbool_from_bool(qlit->value.qbool));\n> +    case QTYPE_NONE:\n\nPlease make that\n\n       default:\n\nto remove the compiler's license to have the function return null on\ncorrupted qlit->type.  If compilers gripe unless you keep case\nQTYPE_NONE in place, keep it.\n\n\n> +        assert(0);\n> +    }\n> +\n> +    return NULL;\n> +}\n> diff --git a/tests/check-qlit.c b/tests/check-qlit.c\n> index c59ec1ab88..acd6e02e96 100644\n> --- a/tests/check-qlit.c\n> +++ b/tests/check-qlit.c\n> @@ -64,11 +64,37 @@ static void qlit_equal_qobject_test(void)\n>      qobject_decref(qobj);\n>  }\n>  \n> +static void qobject_from_qlit_test(void)\n> +{\n> +    QObject *obj, *qobj = qobject_from_qlit(&qlit);\n> +    QDict *qdict;\n> +    QList *bee;\n> +\n> +    qdict = qobject_to_qdict(qobj);\n> +    g_assert_cmpint(qdict_get_int(qdict, \"foo\"), ==, 42);\n> +    g_assert_cmpstr(qdict_get_str(qdict, \"bar\"), ==, \"hello world\");\n> +    g_assert(qobject_type(qdict_get(qdict, \"baz\")) == QTYPE_QNULL);\n> +\n> +    bee = qdict_get_qlist(qdict, \"bee\");\n> +    obj = qlist_pop(bee);\n> +    g_assert_cmpint(qnum_get_int(qobject_to_qnum(obj)), ==, 43);\n> +    qobject_decref(obj);\n> +    obj = qlist_pop(bee);\n> +    g_assert_cmpint(qnum_get_int(qobject_to_qnum(obj)), ==, 44);\n> +    qobject_decref(obj);\n> +    obj = qlist_pop(bee);\n> +    g_assert(qbool_get_bool(qobject_to_qbool(obj)));\n> +    qobject_decref(obj);\n> +\n> +    qobject_decref(qobj);\n> +}\n> +\n>  int main(int argc, char **argv)\n>  {\n>      g_test_init(&argc, &argv, NULL);\n>  \n>      g_test_add_func(\"/qlit/equal_qobject\", qlit_equal_qobject_test);\n> +    g_test_add_func(\"/qlit/qobject_from_qlit\", qobject_from_qlit_test);\n>  \n>      return g_test_run();\n>  }\n\nWith the assertion tightened and the typos pointed out by Eric fixed:\n\nReviewed-by: Markus Armbruster <armbru@redhat.com>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3ysLnl6276z9sNd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Dec 2017 01:38:18 +1100 (AEDT)","from localhost ([::1]:55971 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1eMapx-0001U3-11\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Dec 2017 09:38:13 -0500","from eggs.gnu.org ([2001:4830:134:3::10]:46808)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1eMapT-0001Tr-1p\n\tfor qemu-devel@nongnu.org; Wed, 06 Dec 2017 09:37:44 -0500","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1eMapP-00044A-UV\n\tfor qemu-devel@nongnu.org; Wed, 06 Dec 2017 09:37:43 -0500","from mx1.redhat.com ([209.132.183.28]:40628)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <armbru@redhat.com>) id 1eMapP-00041Q-Ma\n\tfor qemu-devel@nongnu.org; Wed, 06 Dec 2017 09:37:39 -0500","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 2E45EC01416B\n\tfor <qemu-devel@nongnu.org>; Wed,  6 Dec 2017 14:37:38 +0000 (UTC)","from blackfin.pond.sub.org (ovpn-116-74.ams2.redhat.com\n\t[10.36.116.74])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id E0DEF7840E;\n\tWed,  6 Dec 2017 14:37:32 +0000 (UTC)","by blackfin.pond.sub.org (Postfix, from userid 1000)\n\tid 43E941138659; Wed,  6 Dec 2017 15:37:31 +0100 (CET)"],"From":"Markus Armbruster <armbru@redhat.com>","To":"=?utf-8?q?Marc-Andr=C3=A9?= Lureau <marcandre.lureau@redhat.com>","References":"<20170911110623.24981-1-marcandre.lureau@redhat.com>\n\t<20170911110623.24981-2-marcandre.lureau@redhat.com>","Date":"Wed, 06 Dec 2017 15:37:31 +0100","In-Reply-To":"<20170911110623.24981-2-marcandre.lureau@redhat.com> (\n\t=?utf-8?b?Ik1hcmMtQW5kcsOp?= Lureau\"'s message of \"Mon,\n\t11 Sep 2017 13:05:34 +0200\")","Message-ID":"<87shcnzzv8.fsf@dusky.pond.sub.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.13","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tWed, 06 Dec 2017 14:37:38 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-devel@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1816972,"web_url":"http://patchwork.ozlabs.org/comment/1816972/","msgid":"<87tvx3zzvd.fsf@dusky.pond.sub.org>","list_archive_url":null,"date":"2017-12-06T14:37:26","subject":"Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()","submitter":{"id":2645,"url":"http://patchwork.ozlabs.org/api/people/2645/","name":"Markus Armbruster","email":"armbru@redhat.com"},"content":"Marc-André Lureau <marcandre.lureau@redhat.com> writes:\n\n> ----- Original Message -----\n>> On 09/11/2017 06:05 AM, Marc-André Lureau wrote:\n>> > Instanciate a QObject* form a literal QLitObject.\n>> \n>> s/Instanciate/Instantiate/\n>> s/form/from/\n>\n> thanks\n>\n>> \n>> > \n>> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n>> > ---\n>> >  include/qapi/qmp/qlit.h |  2 ++\n>> >  qobject/qlit.c          | 36 ++++++++++++++++++++++++++++++++++++\n>> >  tests/check-qlit.c      | 26 ++++++++++++++++++++++++++\n>> >  3 files changed, 64 insertions(+)\n>> \n>> > +QObject *qobject_from_qlit(const QLitObject *qlit)\n>> > +{\n>> > +    switch (qlit->type) {\n>> > +    case QTYPE_QNULL:\n>> > +        return QOBJECT(qnull());\n>> > +    case QTYPE_QNUM:\n>> > +        return QOBJECT(qnum_from_int(qlit->value.qnum));\n>> \n>> Is this going to work for all QNum values?\n>> \n>> > +++ b/tests/check-qlit.c\n>> > @@ -64,11 +64,37 @@ static void qlit_equal_qobject_test(void)\n>> >      qobject_decref(qobj);\n>> >  }\n>> >  \n>> > +static void qobject_from_qlit_test(void)\n>> > +{\n>> > +    QObject *obj, *qobj = qobject_from_qlit(&qlit);\n>> > +    QDict *qdict;\n>> > +    QList *bee;\n>> > +\n>> > +    qdict = qobject_to_qdict(qobj);\n>> > +    g_assert_cmpint(qdict_get_int(qdict, \"foo\"), ==, 42);\n>> > +    g_assert_cmpstr(qdict_get_str(qdict, \"bar\"), ==, \"hello world\");\n>> > +    g_assert(qobject_type(qdict_get(qdict, \"baz\")) == QTYPE_QNULL);\n>> \n>> Related to my question above - you pass because there are no floating\n>> point values in qlit.  Is that something we want supported?\n>\n> 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.\n\nYes, QLitObject only supports int64_t for now.  uint64_t and double\naren't implemented.\n\nBy the way, shouldn't QLitObject member type be QType instead of int?","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3ysLnl626Tz9sCZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Dec 2017 01:38:18 +1100 (AEDT)","from localhost ([::1]:55972 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1eMapz-0001Uq-51\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Dec 2017 09:38:15 -0500","from eggs.gnu.org ([2001:4830:134:3::10]:46826)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1eMapU-0001Tt-9X\n\tfor qemu-devel@nongnu.org; Wed, 06 Dec 2017 09:37:45 -0500","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <armbru@redhat.com>) id 1eMapT-00047v-Eu\n\tfor qemu-devel@nongnu.org; Wed, 06 Dec 2017 09:37:44 -0500","from mx1.redhat.com ([209.132.183.28]:51502)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <armbru@redhat.com>) id 1eMapT-00046y-8J\n\tfor qemu-devel@nongnu.org; Wed, 06 Dec 2017 09:37:43 -0500","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 5EC052CE919\n\tfor <qemu-devel@nongnu.org>; Wed,  6 Dec 2017 14:37:42 +0000 (UTC)","from blackfin.pond.sub.org (ovpn-116-74.ams2.redhat.com\n\t[10.36.116.74])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 1CD447841F;\n\tWed,  6 Dec 2017 14:37:33 +0000 (UTC)","by blackfin.pond.sub.org (Postfix, from userid 1000)\n\tid DB6791138658; Wed,  6 Dec 2017 15:37:26 +0100 (CET)"],"From":"Markus Armbruster <armbru@redhat.com>","To":"=?utf-8?q?Marc-Andr=C3=A9?= Lureau <marcandre.lureau@redhat.com>","References":"<20170911110623.24981-1-marcandre.lureau@redhat.com>\n\t<20170911110623.24981-2-marcandre.lureau@redhat.com>\n\t<60e9ce8a-9473-cf55-5429-f70902bc59c2@redhat.com>\n\t<752107234.14989591.1505311690362.JavaMail.zimbra@redhat.com>","Date":"Wed, 06 Dec 2017 15:37:26 +0100","In-Reply-To":"<752107234.14989591.1505311690362.JavaMail.zimbra@redhat.com> (\n\t=?utf-8?b?Ik1hcmMtQW5kcsOp?= Lureau\"'s message of \"Wed,\n\t13 Sep 2017 \t10:08:10 -0400 (EDT)\")","Message-ID":"<87tvx3zzvd.fsf@dusky.pond.sub.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.13","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.29]);\n\tWed, 06 Dec 2017 14:37:42 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"qemu-devel@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]