From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnlUs-0000TE-P4 for qemu-devel@nongnu.org; Fri, 01 Sep 2017 08:56:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dnlUj-0007Ml-Ks for qemu-devel@nongnu.org; Fri, 01 Sep 2017 08:56:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51074) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dnlUj-0007La-Cf for qemu-devel@nongnu.org; Fri, 01 Sep 2017 08:56:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44636C056784 for ; Fri, 1 Sep 2017 12:56:20 +0000 (UTC) From: Markus Armbruster Date: Fri, 1 Sep 2017 14:55:35 +0200 Message-Id: <20170901125611.29295-12-armbru@redhat.com> In-Reply-To: <20170901125611.29295-1-armbru@redhat.com> References: <20170901125611.29295-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 11/47] qlit: add QLIT_QNULL and QLIT_BOOL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-Andr=C3=A9 Lureau As they are going to be used in the following patches. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Message-Id: <20170825105913.4060-9-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster --- include/qapi/qmp/qlit.h | 5 +++++ qobject/qlit.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/include/qapi/qmp/qlit.h b/include/qapi/qmp/qlit.h index fc1a2d845d..b18406bce9 100644 --- a/include/qapi/qmp/qlit.h +++ b/include/qapi/qmp/qlit.h @@ -23,6 +23,7 @@ typedef struct QLitObject QLitObject; struct QLitObject { int type; union { + bool qbool; int64_t qnum; const char *qstr; QLitDictEntry *qdict; @@ -35,6 +36,10 @@ struct QLitDictEntry { QLitObject value; }; =20 +#define QLIT_QNULL \ + { .type =3D QTYPE_QNULL } +#define QLIT_QBOOL(val) \ + { .type =3D QTYPE_QBOOL, .value.qbool =3D (val) } #define QLIT_QNUM(val) \ { .type =3D QTYPE_QNUM, .value.qnum =3D (val) } #define QLIT_QSTR(val) \ diff --git a/qobject/qlit.c b/qobject/qlit.c index ae2787ef35..07ad6b05e8 100644 --- a/qobject/qlit.c +++ b/qobject/qlit.c @@ -50,6 +50,8 @@ bool qlit_equal_qobject(const QLitObject *lhs, const QO= bject *rhs) } =20 switch (lhs->type) { + case QTYPE_QBOOL: + return lhs->value.qbool =3D=3D qbool_get_bool(qobject_to_qbool(r= hs)); case QTYPE_QNUM: g_assert(qnum_get_try_int(qobject_to_qnum(rhs), &val)); return lhs->value.qnum =3D=3D val; @@ -81,6 +83,8 @@ bool qlit_equal_qobject(const QLitObject *lhs, const QO= bject *rhs) =20 return helper.result; } + case QTYPE_QNULL: + return true; default: break; } --=20 2.13.5