mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
qapi: Replace start_optional()/end_optional() by optional()
Semantics of end_optional() differ subtly from the other end_FOO()
callbacks: when start_FOO() succeeds, the matching end_FOO() gets
called regardless of what happens in between. end_optional() gets
called only when everything in between succeeds as well. Entirely
undocumented, like all of the visitor API.
The only user of Visitor Callback end_optional() never did anything,
and was removed in commit 9f9ab46
.
I'm about to clean up error handling in the generated visitor code,
and end_optional() is in my way. No users mean no test cases, and
making non-trivial cleanup transformations without test cases doesn't
strike me as a good idea.
Drop end_optional(), and rename start_optional() to optional(). We
can always go back to a pair of callbacks when we have an actual need.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
cbc95538ed
commit
e2cd0f4fb4
8 changed files with 19 additions and 31 deletions
|
@ -69,18 +69,11 @@ void visit_end_list(Visitor *v, Error **errp)
|
|||
v->end_list(v, errp);
|
||||
}
|
||||
|
||||
void visit_start_optional(Visitor *v, bool *present, const char *name,
|
||||
Error **errp)
|
||||
void visit_optional(Visitor *v, bool *present, const char *name,
|
||||
Error **errp)
|
||||
{
|
||||
if (!error_is_set(errp) && v->start_optional) {
|
||||
v->start_optional(v, present, name, errp);
|
||||
}
|
||||
}
|
||||
|
||||
void visit_end_optional(Visitor *v, Error **errp)
|
||||
{
|
||||
if (!error_is_set(errp) && v->end_optional) {
|
||||
v->end_optional(v, errp);
|
||||
if (!error_is_set(errp) && v->optional) {
|
||||
v->optional(v, present, name, errp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue