From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b33KT-0007Eq-CB for qemu-devel@nongnu.org; Wed, 18 May 2016 11:24:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b33KP-0008U3-55 for qemu-devel@nongnu.org; Wed, 18 May 2016 11:24:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b33KO-0008Tl-Sj for qemu-devel@nongnu.org; Wed, 18 May 2016 11:24:05 -0400 References: <1461903820-3092-1-git-send-email-eblake@redhat.com> <1461903820-3092-8-git-send-email-eblake@redhat.com> <87lh3som6o.fsf@dusky.pond.sub.org> <573C8748.5040509@redhat.com> From: Eric Blake Message-ID: <573C8912.9090108@redhat.com> Date: Wed, 18 May 2016 09:24:02 -0600 MIME-Version: 1.0 In-Reply-To: <573C8748.5040509@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="foARoeVAK1P5xTq5gqs74kMQNHXJITjLN" Subject: Re: [Qemu-devel] [PATCH v3 07/18] qapi: Add json output visitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, famz@redhat.com, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --foARoeVAK1P5xTq5gqs74kMQNHXJITjLN Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/18/2016 09:16 AM, Eric Blake wrote: >>> +static void json_output_type_any(Visitor *v, const char *name, QObje= ct **obj, >>> + Error **errp) >>> +{ >>> + JsonOutputVisitor *jov =3D to_jov(v); >>> + QString *str =3D qobject_to_json(*obj); >>> + assert(str); >> >> Can't happen. >=20 > Can too. From tests/check-qobject-json.c: >=20 > obj =3D QOBJECT(qstring_from_str(utf8_in)); > str =3D qobject_to_json(obj); > if (json_out) { > g_assert(str); > g_assert_cmpstr(qstring_get_str(str), =3D=3D, json_out); > } else { > g_assert(!str); > } >=20 > where the failures occur when it is impossible to output proper UTF-8 > due to invalid encoding in a string. Correction - that test has dead code, because: json_out =3D test_cases[i].json_out ?: test_cases[i].json_in; so you are right after all - we currently cannot fail on a conversion to JSON (although the result might not be valid JSON). At any rate, my conclusion remains: > Arguably, that case would be nicer > if it could set an Error* (and would make my argument for setting an > error on Inf/NaN for numbers also a bit more tenable), but that is > additional work that I haven't tackled yet. I'm trying to get the serie= s > posted for another round of review, where I've done some major > reshuffling (such as doing the clone visitor first, not second, in the > series), so hopefully later today. >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --foARoeVAK1P5xTq5gqs74kMQNHXJITjLN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXPIkSAAoJEKeha0olJ0Nq6NAIAIR6Sm3Cwr8RVRVoN8bnTigN /CknAR4FtHdclt6DWBxWVQEEwjfWxjC5SuqrUf1y/cS3PE0xbcbv5Nwis2h0umja mJam1mSpOoNyfTX2I6/stw4sdW7wFZ1k0a4oi5nssDZ/xcRB+d3bFAUdCrDcyLCU QfCsewja9Nye/kKJPIeBeNU9qOXUhOHhI4sk8p1TvfK7zVGPwq/2M1A9o4VRhXuf qxmz4An0r8UbrnWzICPqU0CXo+NBCnSanXGt20ZSQAxvLy+eGQLGR2Z/zmy9MyOq v1vXGXpAjp4PdjsreLSjRWMZsjxd4/Iwi0SCUaiS43autLsAsapd5WQwL3i94Uw= =FxJP -----END PGP SIGNATURE----- --foARoeVAK1P5xTq5gqs74kMQNHXJITjLN--