aboutsummaryrefslogtreecommitdiff
path: root/block/crypto.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-09 10:48:36 -0600
committerMarkus Armbruster <armbru@redhat.com>2016-07-06 10:52:04 +0200
commit09204eac9bb513e56992c00c75f32f9d4766256b (patch)
treea83c6884b990b0d3782cc1f40f69787085f4a6cd /block/crypto.c
parent2c0ef9f411ae6081efa9eca5b3eab2dbeee45a6c (diff)
opts-visitor: Favor new visit_free() function
Now that we have a polymorphic visit_free(), we no longer need opts_visitor_cleanup(); which in turn means we no longer need to return a subtype from opts_visitor_new() nor a public upcast function. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1465490926-28625-6-git-send-email-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'block/crypto.c')
-rw-r--r--block/crypto.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/block/crypto.c b/block/crypto.c
index 5f0ab4d8b8..9bb55d3a73 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -193,17 +193,16 @@ block_crypto_open_opts_init(QCryptoBlockFormat format,
QemuOpts *opts,
Error **errp)
{
- OptsVisitor *ov;
+ Visitor *v;
QCryptoBlockOpenOptions *ret = NULL;
Error *local_err = NULL;
ret = g_new0(QCryptoBlockOpenOptions, 1);
ret->format = format;
- ov = opts_visitor_new(opts);
+ v = opts_visitor_new(opts);
- visit_start_struct(opts_get_visitor(ov),
- NULL, NULL, 0, &local_err);
+ visit_start_struct(v, NULL, NULL, 0, &local_err);
if (local_err) {
goto out;
}
@@ -211,7 +210,7 @@ block_crypto_open_opts_init(QCryptoBlockFormat format,
switch (format) {
case Q_CRYPTO_BLOCK_FORMAT_LUKS:
visit_type_QCryptoBlockOptionsLUKS_members(
- opts_get_visitor(ov), &ret->u.luks, &local_err);
+ v, &ret->u.luks, &local_err);
break;
default:
@@ -219,10 +218,10 @@ block_crypto_open_opts_init(QCryptoBlockFormat format,
break;
}
if (!local_err) {
- visit_check_struct(opts_get_visitor(ov), &local_err);
+ visit_check_struct(v, &local_err);
}
- visit_end_struct(opts_get_visitor(ov), NULL);
+ visit_end_struct(v, NULL);
out:
if (local_err) {
@@ -230,7 +229,7 @@ block_crypto_open_opts_init(QCryptoBlockFormat format,
qapi_free_QCryptoBlockOpenOptions(ret);
ret = NULL;
}
- opts_visitor_cleanup(ov);
+ visit_free(v);
return ret;
}
@@ -240,17 +239,16 @@ block_crypto_create_opts_init(QCryptoBlockFormat format,
QemuOpts *opts,
Error **errp)
{
- OptsVisitor *ov;
+ Visitor *v;
QCryptoBlockCreateOptions *ret = NULL;
Error *local_err = NULL;
ret = g_new0(QCryptoBlockCreateOptions, 1);
ret->format = format;
- ov = opts_visitor_new(opts);
+ v = opts_visitor_new(opts);
- visit_start_struct(opts_get_visitor(ov),
- NULL, NULL, 0, &local_err);
+ visit_start_struct(v, NULL, NULL, 0, &local_err);
if (local_err) {
goto out;
}
@@ -258,7 +256,7 @@ block_crypto_create_opts_init(QCryptoBlockFormat format,
switch (format) {
case Q_CRYPTO_BLOCK_FORMAT_LUKS:
visit_type_QCryptoBlockCreateOptionsLUKS_members(
- opts_get_visitor(ov), &ret->u.luks, &local_err);
+ v, &ret->u.luks, &local_err);
break;
default:
@@ -266,10 +264,10 @@ block_crypto_create_opts_init(QCryptoBlockFormat format,
break;
}
if (!local_err) {
- visit_check_struct(opts_get_visitor(ov), &local_err);
+ visit_check_struct(v, &local_err);
}
- visit_end_struct(opts_get_visitor(ov), NULL);
+ visit_end_struct(v, NULL);
out:
if (local_err) {
@@ -277,7 +275,7 @@ block_crypto_create_opts_init(QCryptoBlockFormat format,
qapi_free_QCryptoBlockCreateOptions(ret);
ret = NULL;
}
- opts_visitor_cleanup(ov);
+ visit_free(v);
return ret;
}