Received: from eggs.gnu.org ([2001:4830:134:3::10]:60719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btyg9-0008De-K1 for qemu-devel@nongnu.org; Tue, 11 Oct 2016 11:09:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btyg5-0000F0-Bg for qemu-devel@nongnu.org; Tue, 11 Oct 2016 11:09:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btyg5-0000Ec-1i for qemu-devel@nongnu.org; Tue, 11 Oct 2016 11:09:13 -0400 References: <1476105837-9861-1-git-send-email-eblake@redhat.com> <1476105837-9861-13-git-send-email-eblake@redhat.com> From: Eric Blake Message-ID: <0f9ead65-b714-de45-a83d-ff10bba84e5f@redhat.com> Date: Tue, 11 Oct 2016 10:09:11 -0500 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3QgvhsT7aVcS37B5WHOAQVucEhjM1JpWv" Subject: Re: [Qemu-devel] [PATCH v6 12/15] qapi: Support pretty printing in JSON output visitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , qemu-devel@nongnu.org Cc: armbru@redhat.com, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3QgvhsT7aVcS37B5WHOAQVucEhjM1JpWv From: Eric Blake To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , qemu-devel@nongnu.org Cc: armbru@redhat.com, Michael Roth Message-ID: <0f9ead65-b714-de45-a83d-ff10bba84e5f@redhat.com> Subject: Re: [Qemu-devel] [PATCH v6 12/15] qapi: Support pretty printing in JSON output visitor References: <1476105837-9861-1-git-send-email-eblake@redhat.com> <1476105837-9861-13-git-send-email-eblake@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/11/2016 06:20 AM, Marc-Andr=C3=A9 Lureau wrote: > On Mon, Oct 10, 2016 at 5:44 PM Eric Blake wrote: >=20 >> Add pretty printing, where the format intentionally matches that of >> qobject_to_json() (a later patch will then rework qobject-json.c to >> work on top of the JSON visitor). The trickiest part is probably >> that the testsuite now has to honor parameterization on whether >> pretty printing is enabled. >> >> >> static void visitor_output_setup(TestOutputVisitorData *data, >> - const void *unused) >> + const void *arg) >> { >> - data->ov =3D json_output_visitor_new(&data->str); >> + bool pretty =3D *(bool *)arg; >> + >> >=20 > Have you considered GPOINTER_TO_INT/GINT_TO_POINTER instead of pointers= to > the stack frame? Casting integer values to void* and back requires a lot of typing to pacify all compilers (either explicit casts, or casts hidden inside the lengthy macro names from glib); and fails to work for 64-bit values when void* is only 32 bits. Dereferencing a stack pointer is a lot less thought and less typing, and works regardless of the integer size. >=20 > either way, it's fine. >=20 Good, I won't bother changing it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --3QgvhsT7aVcS37B5WHOAQVucEhjM1JpWv 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/ iQEcBAEBCAAGBQJX/QCXAAoJEKeha0olJ0NqsMQH/in44OwqhPr9N6i2LI+lgUmy ZYCjD19dbLGjjEVrRpTz6dsfuQehIA2qi242vOx2NVvP8rl+fdMGZh4GxOiUl1Rx yteOaRRGuNmnDbBFBBMwATkvgMIfT7Srch1ov3nTV8ZGdu8oF+wnseTvLwTGH1Vb zbEEHIo0gsWjFtUL1hUtK+iSQ2Q/6ZiX3WJD0IPQPDzZY2XDWDgtG0g80rHnpxt1 VHDTbxy3gZ4Lbm1NiROfMUJ3jZVM4wBqo4F1BfVqyxIYhwch/bDvLElmBkpNDzJ3 StcCn68gQWVQrXJfcbg9sOhTNsRNpa++7fgp9e10E/ejNiwi0rxYiixXeWwRHKU= =r7I+ -----END PGP SIGNATURE----- --3QgvhsT7aVcS37B5WHOAQVucEhjM1JpWv--