From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcfpR-0002g7-4u for qemu-devel@nongnu.org; Thu, 17 Sep 2015 16:30:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcfpM-00017A-7M for qemu-devel@nongnu.org; Thu, 17 Sep 2015 16:30:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcfpL-000154-TZ for qemu-devel@nongnu.org; Thu, 17 Sep 2015 16:30:44 -0400 References: <88451f26df139c09b56b1525f3c5afeea43dd3db.1441627175.git.DirtY.iCE.hu@gmail.com> From: Eric Blake Message-ID: <55FB22EA.6030506@redhat.com> Date: Thu, 17 Sep 2015 14:30:34 -0600 MIME-Version: 1.0 In-Reply-To: <88451f26df139c09b56b1525f3c5afeea43dd3db.1441627175.git.DirtY.iCE.hu@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2qOVGU67QV3FWPpaLQnHwj93ilW014Eat" 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: Markus Armbruster , Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2qOVGU67QV3FWPpaLQnHwj93ilW014Eat Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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). >=20 > Signed-off-by: K=C5=91v=C3=A1g=C3=B3, Zolt=C3=A1n > --- > qapi/opts-visitor.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) Reviewed-by: Eric Blake and required for 'make check' to pass when 4/7 is applied, so: 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 ch= ar *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); 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 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --2qOVGU67QV3FWPpaLQnHwj93ilW014Eat 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+yLqAAoJEKeha0olJ0Nqc8gIAJDZRkuKMn5yNJDAgDbLoILb pDvRMjnt3JT3B8j0MhbwEoFAFZUL4c4TeDCX4EGkj9buH7hRJrl7wVYXceBnuoxu SwVNWYtnFQgLCTeq/wzXjPaRivP1qsn/7RBr3MfQ1+QYO/annyayi8FxhfoPgJvg v0GEsYoP1AXApl06iNZaYPxuN8rQbGNps/PE4MyZ/DUJ1rHCcz+thoPUmHsyQevc 8WVZ3DhFWBRC1l6Ref9ni6rO6PFnwz5tCxgaYjtBvqrh3uca9Q2oaaRP8WGIAzX2 SAH19AXX/+FV4KX7Q7OOZ5MhEgOB/ioArZ/iyk22tNrTaHzdfaPeIAtfbEeaCP4= =SRRj -----END PGP SIGNATURE----- --2qOVGU67QV3FWPpaLQnHwj93ilW014Eat--