unicorn/qemu/qapi
Eric Blake 49b8891872
qmp: Don't abuse stack to track qmp-output root
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() and
qmp_output_last() 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.

Backports commit 455ba08afde784466420449d01c6458f88349d55 from qemu
2018-02-20 08:09:56 -05:00
..
common.json qapi: Add alias for ErrorClass 2018-02-19 20:38:51 -05:00
Makefile.objs
qapi-dealloc-visitor.c qapi: Drop unused 'kind' for struct/enum visit 2018-02-19 23:43:54 -05:00
qapi-visit-core.c qapi: Drop unused 'kind' for struct/enum visit 2018-02-19 23:43:54 -05:00
qmp-input-visitor.c qapi: Tighten qmp_input_end_list() 2018-02-19 23:44:45 -05:00
qmp-output-visitor.c qmp: Don't abuse stack to track qmp-output root 2018-02-20 08:09:56 -05:00
string-input-visitor.c qapi: Swap 'name' in visit_* callbacks to match public API 2018-02-19 23:36:52 -05:00