[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 13/26] qapi: Drop string input visitor method opt
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH v2 13/26] qapi: Drop string input visitor method optional() |
Date: |
Sun, 26 Feb 2017 22:43:31 +0100 |
visit_optional() is to be called only between visit_start_struct() and
visit_end_struct(). Visitors that don't support struct visits,
i.e. don't implement start_struct(), end_struct(), have no use for it.
Clarify documentation.
The string input visitor doesn't support struct visits. Its
parse_optional() is therefore useless. Drop it.
Signed-off-by: Markus Armbruster <address@hidden>
---
include/qapi/visitor-impl.h | 4 ++--
qapi/string-input-visitor.c | 13 -------------
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h
index 8bd47ee..962ba1d 100644
--- a/include/qapi/visitor-impl.h
+++ b/include/qapi/visitor-impl.h
@@ -102,8 +102,8 @@ struct Visitor
/* Must be set to visit explicit null values. */
void (*type_null)(Visitor *v, const char *name, Error **errp);
- /* Must be set for input visitors, optional otherwise. The core
- * takes care of the return type in the public interface. */
+ /* Must be set for input visitors to visit structs, optional otherwise.
+ The core takes care of the return type in the public interface. */
void (*optional)(Visitor *v, const char *name, bool *present);
/* Must be set */
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index 8dfa561..1a855c5 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -314,18 +314,6 @@ static void parse_type_number(Visitor *v, const char
*name, double *obj,
*obj = val;
}
-static void parse_optional(Visitor *v, const char *name, bool *present)
-{
- StringInputVisitor *siv = to_siv(v);
-
- if (!siv->string) {
- *present = false;
- return;
- }
-
- *present = true;
-}
-
static void string_input_free(Visitor *v)
{
StringInputVisitor *siv = to_siv(v);
@@ -351,7 +339,6 @@ Visitor *string_input_visitor_new(const char *str)
v->visitor.start_list = start_list;
v->visitor.next_list = next_list;
v->visitor.end_list = end_list;
- v->visitor.optional = parse_optional;
v->visitor.free = string_input_free;
v->string = str;
--
2.7.4
- [Qemu-devel] [PATCH v2 00/26] qapi: QMP dispatch and input visitor work, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 08/26] qmp: Improve QMP dispatch error messages, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 01/26] qga: Fix crash on non-dictionary QMP argument, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 11/26] qapi: Make QObject input visitor set *list reliably, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 02/26] libqtest: Work around a "QMP wants a newline" bug, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 13/26] qapi: Drop string input visitor method optional(),
Markus Armbruster <=
- [Qemu-devel] [PATCH v2 22/26] test-qobject-input-visitor: Cover missing nested struct member, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 10/26] qapi: Clean up after commit 3d344c2, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 04/26] qmp: Dumb down how we run QMP command registration, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 19/26] test-string-input-visitor: Tear down existing test automatically, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 12/26] qapi: Improve qobject input visitor error reporting, Markus Armbruster, 2017/02/26