From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4xkx-0001p0-Ng for qemu-devel@nongnu.org; Fri, 04 Dec 2015 16:19:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a4xku-0006l9-Jz for qemu-devel@nongnu.org; Fri, 04 Dec 2015 16:19:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a4xku-0006kz-Ey for qemu-devel@nongnu.org; Fri, 04 Dec 2015 16:19:04 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 1815A8E363 for ; Fri, 4 Dec 2015 21:19:03 +0000 (UTC) References: <1448497401-27784-1-git-send-email-eblake@redhat.com> <1448497401-27784-10-git-send-email-eblake@redhat.com> From: Eric Blake Message-ID: <5662033F.4020508@redhat.com> Date: Fri, 4 Dec 2015 14:18:55 -0700 MIME-Version: 1.0 In-Reply-To: <1448497401-27784-10-git-send-email-eblake@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xRAgrVjI4M21L5Vfj5ge4jc8xMLLLdibu" Subject: Re: [Qemu-devel] [PATCH v6 09/23] hmp: Improve use of qapi visitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: armbru@redhat.com, Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xRAgrVjI4M21L5Vfj5ge4jc8xMLLLdibu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/25/2015 05:23 PM, Eric Blake wrote: > Cache the visitor in a local variable instead of repeatedly > calling the accessor. Pass NULL for the visit_start_struct() > object (which matches the fact that we were already passing 0 > for the size argument, because we aren't using the visit to > allocate a qapi struct). Pass "object" for the struct name, > for better error messages. Reflow the logic so that we don't > have to undo an object_add(). >=20 > A later patch will then split the error detection currently > in visit_struct_end(), at which point we can again hoist the > object_add() to occur before the label as one of the cleanups > enabled by that split. >=20 > Signed-off-by: Eric Blake >=20 >=20 > - object_add(type, id, pdict, opts_get_visitor(ov), &err); > - > out_end: > - visit_end_struct(opts_get_visitor(ov), &err_end); > - if (!err && err_end) { > - qmp_object_del(id, NULL); > + visit_end_struct(v, &err_end); > + if (!err && !err_end) { > + object_add(type, id, pdict, v, &err); > } The attempt to avoid a qmp_object_del() cleanup on error was honorable, but wrong. Calling visit_end_struct() prior to passing 'v' to object_add() means that object_add() is now visiting a different level of {} than it was pre-patch, which showed up as a testsuite breakage under 'make check-qtest'. I'm reworking this patch (and the similar change to vl.c in 10/23) for v7. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xRAgrVjI4M21L5Vfj5ge4jc8xMLLLdibu 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/ iQEcBAEBCAAGBQJWYgM/AAoJEKeha0olJ0Nq9mIH/RcxYR8XX2qUOsZwcsRgOVvM kSWfbPrpuGnwITwIe9SUzD3UHOk7m6IOMyK+KSZsMyy1kR4W+2z1hzg2pDcH81/8 RZphry1hknsYRoztEClf7Zu/kugnOx8RqYwljI4tunGPG5bymCXe4hjIxeSTiDzd klJA5KwWIurQARf8msLXdAG5mW9jFZstkAqVw+W9p4bIFyI1K/2vj26JagZOkxCy gFkOmQlHivk9rZ74MzsU2Ok41RUO/P1IWvfsRHXw97j9WVBaC78N+ESfD6xTkNOf 3bUsACaAaGoXBCSeyzGAZVV7pjwP9V5z5lmMNMNVgxFuU1c5eSWWkYfd5q9mJ38= =UGcw -----END PGP SIGNATURE----- --xRAgrVjI4M21L5Vfj5ge4jc8xMLLLdibu--