aboutsummaryrefslogtreecommitdiff
path: root/tests/test-string-input-visitor.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-09 10:48:37 -0600
committerMarkus Armbruster <armbru@redhat.com>2016-07-06 10:52:04 +0200
commit7a0525c7be6b38d32d586e3fd12e7377ded21faa (patch)
tree06f7dc1da296b1fea7357044989188c7059b585f /tests/test-string-input-visitor.c
parent09204eac9bb513e56992c00c75f32f9d4766256b (diff)
string-input-visitor: Favor new visit_free() function
Now that we have a polymorphic visit_free(), we no longer need string_input_visitor_cleanup(); which in turn means we no longer need to return a subtype from string_input_visitor_new() nor a public upcast function. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1465490926-28625-7-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/test-string-input-visitor.c')
-rw-r--r--tests/test-string-input-visitor.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
index 7fe7a9c270..d837ebedad 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -20,15 +20,15 @@
#include "qapi/qmp/types.h"
typedef struct TestInputVisitorData {
- StringInputVisitor *siv;
+ Visitor *v;
} TestInputVisitorData;
static void visitor_input_teardown(TestInputVisitorData *data,
const void *unused)
{
- if (data->siv) {
- string_input_visitor_cleanup(data->siv);
- data->siv = NULL;
+ if (data->v) {
+ visit_free(data->v);
+ data->v = NULL;
}
}
@@ -39,15 +39,9 @@ static
Visitor *visitor_input_test_init(TestInputVisitorData *data,
const char *string)
{
- Visitor *v;
-
- data->siv = string_input_visitor_new(string);
- g_assert(data->siv != NULL);
-
- v = string_input_get_visitor(data->siv);
- g_assert(v != NULL);
-
- return v;
+ data->v = string_input_visitor_new(string);
+ g_assert(data->v);
+ return data->v;
}
static void test_visitor_in_int(TestInputVisitorData *data,
@@ -199,8 +193,6 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
visitor_input_teardown(data, NULL);
}
-
- data->siv = NULL;
}
/* Try to crash the visitors */