From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWRsy-00028o-DZ for qemu-devel@nongnu.org; Thu, 18 Feb 2016 11:57:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWRsu-0001oA-De for qemu-devel@nongnu.org; Thu, 18 Feb 2016 11:57:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWRsu-0001nw-7r for qemu-devel@nongnu.org; Thu, 18 Feb 2016 11:56:56 -0500 References: <1455778109-6278-1-git-send-email-eblake@redhat.com> <1455778109-6278-13-git-send-email-eblake@redhat.com> <874md69dfi.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <56C5F7D6.4060801@redhat.com> Date: Thu, 18 Feb 2016 09:56:54 -0700 MIME-Version: 1.0 In-Reply-To: <874md69dfi.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="KajMuemrlIFHOGMN2S7UhO0pwc02mQB0m" Subject: Re: [Qemu-devel] [PATCH v11 12/15] qapi: Don't box struct branch of alternate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --KajMuemrlIFHOGMN2S7UhO0pwc02mQB0m Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/18/2016 09:43 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> There's no reason to do two malloc's for an alternate type visiting >> a QAPI struct; let's just inline the struct directly as the C union >> branch of the struct. >> >> >> meanwhile, in qapi-visit.h, we trade the previous visit_type_FOO(obj) >=20 > Meanwhile >=20 >> (which allocates a pointer, handles a layer of {} from the JSON stream= , >> and visits the fields) Maybe: (which first calls visit_start_struct(v, name, obj, size, &err) to allocate a pointer and handle a layer of {} from the JSON stream, then visits the fields) >> with an inline call to visit_type_FOO(NULL) (t= o >> consume the {} without allocation) and a direct visit of the fields: >=20 > I don't see a call to visit_type_FOO(NULL). Whoops, wrong function name. I meant: visit_start_struct(v, name, NULL, 0, &err). ^^^^ Especially useful if you take my earlier text suggestion to point out the difference in the visit_start_struct() calls as being the intentional so that we continue to consume {} but now opt out of a second allocation. >=20 > Suggest not to abbreviate argument lists, it's mildly confusing. Sure. Are we still at a point that you could touch up the commit message without a patch respin? >=20 > Patch looks good. >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --KajMuemrlIFHOGMN2S7UhO0pwc02mQB0m 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/ iQEcBAEBCAAGBQJWxffXAAoJEKeha0olJ0Nq9EsH/Aszw/f7Jpd6refzLBt8C3Ql Bo9GpbPr6MECKzdErwhFCGlAPavY/a6274t11S77QXIm1Nhui8cutmQ2s6NLTFvD UeJUJEvhEHven/VsUeO/weu6kqm9GMTxT3YnnC3B+lRe/Sg/1QuA5FsouBuLUL4w F8wYqEz+je8ICax8pLCzqbVCXK6K+hPtBbvRUQaS4mC9FxTb9Svf/xb/wHGUsv/0 kO/l8gl2kwOmUIH7bkWwtFZ3bnNCq/a7gfqW8bo+Oq3R8UrQXB9urcN2epGrMmag bqW29cFXx64lndfhwPbBOdaB415rpXV/ylgd1osp+ML3hWVT78XeHGA0CDl2NGM= =D81M -----END PGP SIGNATURE----- --KajMuemrlIFHOGMN2S7UhO0pwc02mQB0m--