aboutsummaryrefslogtreecommitdiff
path: root/qapi/string-input-visitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-05-07 09:53:46 +0200
committerLuiz Capitulino <lcapitulino@redhat.com>2014-05-15 14:00:45 -0400
commite2cd0f4fb42b1fae65ad22e8efde9804446e6254 (patch)
treef8ea58b96ee1114f9dd0c45d67d567faec516df3 /qapi/string-input-visitor.c
parentcbc95538eda98929d2c5c8ff0d9db9043fcf1ae6 (diff)
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>
Diffstat (limited to 'qapi/string-input-visitor.c')
-rw-r--r--qapi/string-input-visitor.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index 793548ae3a..5780944792 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -120,8 +120,8 @@ static void parse_type_number(Visitor *v, double *obj, const char *name,
*obj = val;
}
-static void parse_start_optional(Visitor *v, bool *present,
- const char *name, Error **errp)
+static void parse_optional(Visitor *v, bool *present, const char *name,
+ Error **errp)
{
StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v);
@@ -155,7 +155,7 @@ StringInputVisitor *string_input_visitor_new(const char *str)
v->visitor.type_bool = parse_type_bool;
v->visitor.type_str = parse_type_str;
v->visitor.type_number = parse_type_number;
- v->visitor.start_optional = parse_start_optional;
+ v->visitor.optional = parse_optional;
v->string = str;
return v;