From e2cd0f4fb42b1fae65ad22e8efde9804446e6254 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 7 May 2014 09:53:46 +0200 Subject: 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 Reviewed-by: Eric Blake Signed-off-by: Luiz Capitulino --- qapi/qmp-input-visitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'qapi/qmp-input-visitor.c') diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c index a2bed1ef10..d8612062f1 100644 --- a/qapi/qmp-input-visitor.c +++ b/qapi/qmp-input-visitor.c @@ -286,8 +286,8 @@ static void qmp_input_type_number(Visitor *v, double *obj, const char *name, } } -static void qmp_input_start_optional(Visitor *v, bool *present, - const char *name, Error **errp) +static void qmp_input_optional(Visitor *v, bool *present, const char *name, + Error **errp) { QmpInputVisitor *qiv = to_qiv(v); QObject *qobj = qmp_input_get_object(qiv, name, true); @@ -329,7 +329,7 @@ QmpInputVisitor *qmp_input_visitor_new(QObject *obj) v->visitor.type_bool = qmp_input_type_bool; v->visitor.type_str = qmp_input_type_str; v->visitor.type_number = qmp_input_type_number; - v->visitor.start_optional = qmp_input_start_optional; + v->visitor.optional = qmp_input_optional; v->visitor.get_next_type = qmp_input_get_next_type; qmp_input_push(v, obj, NULL); -- cgit v1.2.3