mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
qapi: Make input visitors detect unvisited list tails
Fix the design flaw demonstrated in the previous commit: new method check_list() lets input visitors report that unvisited input remains for a list, exactly like check_struct() lets them report that unvisited input remains for a struct or union. Implement the method for the qobject input visitor (straightforward), and the string input visitor (less so, due to the magic list syntax there). The opts visitor's list magic is even more impenetrable, and all I can do there today is a stub with a FIXME comment. No worse than before. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1488544368-30622-26-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
86ca0dbe04
commit
a4a1c70dc7
12 changed files with 116 additions and 10 deletions
|
@ -61,6 +61,9 @@ struct Visitor
|
|||
/* Must be set */
|
||||
GenericList *(*next_list)(Visitor *v, GenericList *tail, size_t size);
|
||||
|
||||
/* Optional; intended for input visitors */
|
||||
void (*check_list)(Visitor *v, Error **errp);
|
||||
|
||||
/* Must be set */
|
||||
void (*end_list)(Visitor *v, void **list);
|
||||
|
||||
|
|
|
@ -369,6 +369,19 @@ void visit_start_list(Visitor *v, const char *name, GenericList **list,
|
|||
*/
|
||||
GenericList *visit_next_list(Visitor *v, GenericList *tail, size_t size);
|
||||
|
||||
/*
|
||||
* Prepare for completing a list visit.
|
||||
*
|
||||
* @errp obeys typical error usage, and reports failures such as
|
||||
* unvisited list tail remaining in the input stream.
|
||||
*
|
||||
* Should be called prior to visit_end_list() if all other
|
||||
* intermediate visit steps were successful, to allow the visitor one
|
||||
* last chance to report errors. May be skipped on a cleanup path,
|
||||
* where there is no need to check for further errors.
|
||||
*/
|
||||
void visit_check_list(Visitor *v, Error **errp);
|
||||
|
||||
/*
|
||||
* Complete a list visit started earlier.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue