From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGSEo-0006ma-6Y for qemu-devel@nongnu.org; Tue, 05 Jan 2016 09:05:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGSEn-0000KO-8a for qemu-devel@nongnu.org; Tue, 05 Jan 2016 09:05:26 -0500 Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]:34051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGSEn-0000KA-3x for qemu-devel@nongnu.org; Tue, 05 Jan 2016 09:05:25 -0500 Received: by mail-oi0-x22d.google.com with SMTP id o124so274297235oia.1 for ; Tue, 05 Jan 2016 06:05:25 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1450717720-9627-21-git-send-email-eblake@redhat.com> References: <1450717720-9627-1-git-send-email-eblake@redhat.com> <1450717720-9627-21-git-send-email-eblake@redhat.com> Date: Tue, 5 Jan 2016 15:05:24 +0100 Message-ID: From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v8 20/35] qmp: Don't abuse stack to track qmp-output root List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Michael Roth , QEMU , Markus Armbruster Hi On Mon, Dec 21, 2015 at 6:08 PM, Eric Blake wrote: > The previous commit documented an inconsistency in how we are > using the stack of qmp-output-visitor. Normally, pushing a > single top-level object puts the object on the stack twice: > once as the root, and once as the current container being > appended to; but popping that struct only pops once. However, > qmp_ouput_add() was trying to either set up the added object > as the new root (works if you parse two top-level scalars in a > row: the second replaces the first as the root) or as a member > of the current container (works as long as you have an open > container on the stack; but if you have popped the first > top-level container, it then resolves to the root and still > tries to add into that existing container). > > Fix the stupidity by not tracking two separate things in the > stack. Drop the now-useless qmp_output_first() while at it. > > Saved for a later patch: we still are rather sloppy in that > qmp_output_get_object() can be called in the middle of a parse, > rather than requiring that a visit is complete. > > Signed-off-by: Eric Blake > Reviewed-by: Marc-Andr=C3=A9 Lureau --=20 Marc-Andr=C3=A9 Lureau