From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avnUW-0003tQ-JD for qemu-devel@nongnu.org; Thu, 28 Apr 2016 11:04:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avnUV-0001Cc-G0 for qemu-devel@nongnu.org; Thu, 28 Apr 2016 11:04:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avnUV-0001CU-8j for qemu-devel@nongnu.org; Thu, 28 Apr 2016 11:04:31 -0400 References: <1461801715-24307-1-git-send-email-eblake@redhat.com> <1461801715-24307-11-git-send-email-eblake@redhat.com> <87r3dpkcby.fsf@dusky.pond.sub.org> From: Eric Blake Message-ID: <5722267D.9090800@redhat.com> Date: Thu, 28 Apr 2016 09:04:29 -0600 MIME-Version: 1.0 In-Reply-To: <87r3dpkcby.fsf@dusky.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0a61Mlh5rRQGA3x2tq1vsutbHrBxewNJe" Subject: Re: [Qemu-devel] [PATCH v15 10/23] qmp-input: Require struct push to visit members of top dict 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) --0a61Mlh5rRQGA3x2tq1vsutbHrBxewNJe Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/28/2016 09:00 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> Don't embed the root of the visit into the stack of current >> containers being visited. That way, we no longer get confused >> on whether the first visit of a dictionary is to the dictionary >> itself or to one of the members of the dictionary, based on >> whether the caller passed name=3DNULL; and makes the QMP Input >> visitor like other visitors where the value of 'name' is now >> ignored on the root visit. (We may someday want to revisit >> the rules on what 'name' should be on a top-level visit, >> rather than just ignoring it; but that would be the topic of >> another patch). >> >> An audit of all qmp_input_visitor_new() call sites shows that >> there were only two places where callers had previously been >> visiting to a QDict with a non-NULL name to bypass a call to >> visit_start_struct(), and those were fixed in prior patches. >> >> Signed-off-by: Eric Blake >> >> --- >> @@ -54,33 +56,34 @@ static QObject *qmp_input_get_object(QmpInputVisit= or *qiv, >> const char *name, >> bool consume) >> { >> - StackObject *tos =3D &qiv->stack[qiv->nb_stack - 1]; >> - QObject *qobj =3D tos->obj; >> - QObject *ret; >> + StackObject *tos; >> + QObject *qobj; >> + QObject *ret =3D NULL; >=20 > Dead initializer? >=20 Probably a rebase artifact. >> + if (qobject_type(qobj) =3D=3D QTYPE_QDICT) { >> + assert(name); >> ret =3D qdict_get(qobject_to_qdict(qobj), name); =2E.. >> + } else { >> assert(qobject_type(qobj) =3D=3D QTYPE_QLIST); >> - return qlist_entry_obj(tos->entry); >> + assert(!name); >> + ret =3D qlist_entry_obj(tos->entry); It does indeed get set on all branches, so the initializer can be dropped= =2E --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --0a61Mlh5rRQGA3x2tq1vsutbHrBxewNJe 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/ iQEcBAEBCAAGBQJXIiZ+AAoJEKeha0olJ0NqVE8H/i9VFsNsgjqXZP40PXIaCztG tG5FEd6TWkOzPncQMTH/xenpmmjsMdx3iVWHX0jDjgZFDR1NxCPUIxVl/GMHpf7r iQOQ1gRGb5KZH0VQd1xvM7A1LAYOpdOHBnDcp8fT5ufIsVnwgFeezV40KFhlQusA NSpW8ovAqn+b7CQIAOBG5WD3aoE9MIZIPXI3DqKKCiQFdRe6pzntf9RcN6XRZKqj 1I8GLenM5EIpLR71G0F67RBezrR/qqZ6RL0s/wNY0iCoDnciLMU+BxSXy5WPx+ED mHegOpMJwH3nwaH4/TyobNS2E8mPXbk/kGWDUq42q1FsI4Vo4sHHoMl0p+c4Kyw= =VjxQ -----END PGP SIGNATURE----- --0a61Mlh5rRQGA3x2tq1vsutbHrBxewNJe--