From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGwQ0-0007ZY-NH for qemu-devel@nongnu.org; Wed, 06 Jan 2016 17:19:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGwPw-0008Vy-Lp for qemu-devel@nongnu.org; Wed, 06 Jan 2016 17:19:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGwPw-0008Vu-Ec for qemu-devel@nongnu.org; Wed, 06 Jan 2016 17:18:56 -0500 References: <1450717720-9627-1-git-send-email-eblake@redhat.com> <1450717720-9627-24-git-send-email-eblake@redhat.com> From: Eric Blake Message-ID: <568D92CA.6060802@redhat.com> Date: Wed, 6 Jan 2016 15:18:50 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nhrFXUORBcsE5AofxrSoIP00RuPO3IIbe" Subject: Re: [Qemu-devel] [PATCH v8 23/35] qmp: Tighten output visitor rules List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= Cc: Michael Roth , QEMU , Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --nhrFXUORBcsE5AofxrSoIP00RuPO3IIbe Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/05/2016 07:05 AM, Marc-Andr=C3=A9 Lureau wrote: > Hi >=20 > On Mon, Dec 21, 2015 at 6:08 PM, Eric Blake wrote: >> Add a new qmp_output_visitor_reset(), which must be called before >> reusing an exising QmpOutputVisitor on a new root object. Tighten >> assertions to require that qmp_output_get_qobject() can only be >> called after pairing a visit_end_* for every visit_start_* (rather >> than allowing it to return a partially built object), that it must >> not be called unless at least one visit_type_* or visit_start/ >> visit_end pair has occurred since creation/reset (the accidental >> return of NULL fixed by commit ab8bf1d7 would have been much >> easier to diagnose), and that it may only be called once per visit. >> >> To keep the semantics of test_visitor_out_empty, we now have to >> explicitly request a top-level visit of a NULL object, by >> implementing the just-added visitor type_null() callback. >> >> Signed-off-by: Eric Blake >> >> -void qmp_output_visitor_cleanup(QmpOutputVisitor *v) >> +void qmp_output_visitor_reset(QmpOutputVisitor *v) >> { >> QStackEntry *e, *tmp; >> >> @@ -231,6 +235,12 @@ void qmp_output_visitor_cleanup(QmpOutputVisitor = *v) >> } >> >> qobject_decref(v->root); >> + v->root =3D NULL; >> +} >> + >> +void qmp_output_visitor_cleanup(QmpOutputVisitor *v) >=20 > It would make sense to call it _free() imho.. Pre-existing name, so a cleanup should be in a separate patch. >> @@ -459,6 +460,7 @@ static void test_visitor_out_empty(TestOutputVisit= orData *data, >> { >> QObject *arg; >> >> + visit_type_null(data->ov, NULL, &error_abort); >=20 > I guess this is going to be used outside of just this artificial case. > Otherwise, I would have suggested to get rid of it. Used in 24/35 (in fact, it was discussion on that topic just before 2.5 that prompted me to even add visit_type_null()). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --nhrFXUORBcsE5AofxrSoIP00RuPO3IIbe 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/ iQEcBAEBCAAGBQJWjZLKAAoJEKeha0olJ0NqLUQH/iOs9oZZ8HVln6xmtWRbWd4w bG44m8xCHj4yLrDxr7TRbds+AQ+Y/sweGX+Mnht2bQ03xrCqteyLzWZ9wvGc0ok3 6jqNfPwfS0qvl4dB3D6K8UPFSoPNUXUo5B6jCQBF+4JLmR7vSz0MeP/oAtq6q+5n 6nD65eIIt8sDb+fLshJMQO0SLDJJ0a6nNgBhpWoLd6zu/1401ImTxZrFAqZOLqg9 had0l7ouo6K+wg5gKlPEYDmvfSWiNY/qFsZEMMVICMpgZoSdm0boBNa+bDwlJ0+o cAnuhmyhqKKEhVgNTUxV+DQGwPrS11OzWeszC+QxOngcAITHIA1InaXRig9H8MU= =Dnte -----END PGP SIGNATURE----- --nhrFXUORBcsE5AofxrSoIP00RuPO3IIbe--