From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zcukn-0006sd-M6 for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:27:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zcukk-00083R-En for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:27:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zcukk-00083L-7d for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:26:58 -0400 References: <88451f26df139c09b56b1525f3c5afeea43dd3db.1441627175.git.DirtY.iCE.hu@gmail.com> <55FB22EA.6030506@redhat.com> From: Eric Blake Message-ID: <55FC030C.7040505@redhat.com> Date: Fri, 18 Sep 2015 06:26:52 -0600 MIME-Version: 1.0 In-Reply-To: <55FB22EA.6030506@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FXlE5OnbLQvFKRx03O98efeLNcid0Fl1b" Subject: Re: [Qemu-devel] [PATCH 1/7] qapi: support implicit structs in OptsVisitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?S8WRdsOhZ8OzLCBab2x0w6Fu?= , qemu-devel@nongnu.org Cc: Yang Hongyang , Markus Armbruster , Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --FXlE5OnbLQvFKRx03O98efeLNcid0Fl1b Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/17/2015 02:30 PM, Eric Blake wrote: > On 09/07/2015 06:08 AM, K=C5=91v=C3=A1g=C3=B3, Zolt=C3=A1n wrote: >> They are required for flat unions (you still have to allocate the >> structs). >> >> Signed-off-by: K=C5=91v=C3=A1g=C3=B3, Zolt=C3=A1n >> --- >> qapi/opts-visitor.c | 15 +++++++++++++++ >> 1 file changed, 15 insertions(+) >=20 > Reviewed-by: Eric Blake >=20 > and required for 'make check' to pass when 4/7 is applied, so: >=20 > Tested-by: Eric Blake >=20 >> >> diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c >> index 7ae33b3..aa68814 100644 >> --- a/qapi/opts-visitor.c >> +++ b/qapi/opts-visitor.c >> @@ -149,6 +149,12 @@ opts_start_struct(Visitor *v, void **obj, const c= har *kind, >> } >> } >> =20 >> +static void >> +opts_start_implicit_struct(Visitor *v, void **obj, size_t size, Error= **errp) >> +{ >> + opts_start_struct(v, obj, NULL, NULL, size, errp); >=20 > Works because ov->depth is always non-zero by the time any visitor > reaches this callback, triggering the early return in > opts_start_struct(). Might be slightly safer if you just did the > g_malloc0() here, to make sure no caller ever ends up re-initializing > ov->unprocessed_opts, but what you have works. >=20 In fact, the alternative that just does a local malloc was proposed here:= https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg04746.html --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --FXlE5OnbLQvFKRx03O98efeLNcid0Fl1b 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/ iQEcBAEBCAAGBQJV/AMMAAoJEKeha0olJ0NqIJ8H/2dAsZSMsK0g0Qo4RtukAjcc XILaqjjdlWvwmWd948sLaH1PdOlv+y3h/vvtmM3BLjhRs8rmrSjbFDP9FSej1uP8 T2CJuABjOVErG/TRylLun45W/wdtV2DuN/3N3hFejz9KgFle5RbzQwgU6Z3ukhST wH4G8pX9zOugcZ/NtogBOzyifaO7hN9xp7MWLffsCA+Kxv1vfH0/67klEnYNacMc zzA56LSk1PROEsyQ9am47UB7EkgOofSvZ793LSCr7jpQIkdsJ85tunBdsgN+ftyh Jv2bvnOhUIl3pp0WHae7i2EZb/kzb3XKGSGSLaDWJ6pRfYtsgu5T/12vpw7ajLI= =IjqV -----END PGP SIGNATURE----- --FXlE5OnbLQvFKRx03O98efeLNcid0Fl1b--