aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2018-02-24 16:40:29 +0100
committerEric Blake <eblake@redhat.com>2018-03-19 14:58:36 -0500
commit7dc847ebba953db90853d15f140c20eef74d4fb2 (patch)
treef17aad0438ed253a90674b74732917d449147f07 /block
parent1a56b1e2ab5e9d6d89386ca953b4afb419e15abe (diff)
qapi: Replace qobject_to_X(o) by qobject_to(X, o)
This patch was generated using the following Coccinelle script: @@ expression Obj; @@ ( - qobject_to_qnum(Obj) + qobject_to(QNum, Obj) | - qobject_to_qstring(Obj) + qobject_to(QString, Obj) | - qobject_to_qdict(Obj) + qobject_to(QDict, Obj) | - qobject_to_qlist(Obj) + qobject_to(QList, Obj) | - qobject_to_qbool(Obj) + qobject_to(QBool, Obj) ) and a bit of manual fix-up for overly long lines and three places in tests/check-qjson.c that Coccinelle did not find. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-Id: <20180224154033.29559-4-mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: swap order from qobject_to(o, X), rebase to master, also a fix to latent false-positive compiler complaint about hw/i386/acpi-build.c] Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/parallels.c2
-rw-r--r--block/qapi.c12
-rw-r--r--block/qcow.c2
-rw-r--r--block/qcow2.c2
-rw-r--r--block/qed.c2
-rw-r--r--block/rbd.c8
-rw-r--r--block/sheepdog.c2
-rw-r--r--block/vhdx.c2
-rw-r--r--block/vpc.c2
9 files changed, 17 insertions, 17 deletions
diff --git a/block/parallels.c b/block/parallels.c
index 2da5e56a9d..e2515dec81 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -647,7 +647,7 @@ static int coroutine_fn parallels_co_create_opts(const char *filename,
qobj = qdict_crumple(qdict, errp);
QDECREF(qdict);
- qdict = qobject_to_qdict(qobj);
+ qdict = qobject_to(QDict, qobj);
if (qdict == NULL) {
ret = -EINVAL;
goto done;
diff --git a/block/qapi.c b/block/qapi.c
index 4c9923d262..f2e0aa2cbe 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -647,29 +647,29 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,
{
switch (qobject_type(obj)) {
case QTYPE_QNUM: {
- QNum *value = qobject_to_qnum(obj);
+ QNum *value = qobject_to(QNum, obj);
char *tmp = qnum_to_string(value);
func_fprintf(f, "%s", tmp);
g_free(tmp);
break;
}
case QTYPE_QSTRING: {
- QString *value = qobject_to_qstring(obj);
+ QString *value = qobject_to(QString, obj);
func_fprintf(f, "%s", qstring_get_str(value));
break;
}
case QTYPE_QDICT: {
- QDict *value = qobject_to_qdict(obj);
+ QDict *value = qobject_to(QDict, obj);
dump_qdict(func_fprintf, f, comp_indent, value);
break;
}
case QTYPE_QLIST: {
- QList *value = qobject_to_qlist(obj);
+ QList *value = qobject_to(QList, obj);
dump_qlist(func_fprintf, f, comp_indent, value);
break;
}
case QTYPE_QBOOL: {
- QBool *value = qobject_to_qbool(obj);
+ QBool *value = qobject_to(QBool, obj);
func_fprintf(f, "%s", qbool_get_bool(value) ? "true" : "false");
break;
}
@@ -730,7 +730,7 @@ void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
visit_type_ImageInfoSpecific(v, NULL, &info_spec, &error_abort);
visit_complete(v, &obj);
- data = qdict_get(qobject_to_qdict(obj), "data");
+ data = qdict_get(qobject_to(QDict, obj), "data");
dump_qobject(func_fprintf, f, 1, data);
qobject_decref(obj);
visit_free(v);
diff --git a/block/qcow.c b/block/qcow.c
index 2e3770ca63..f92891676c 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -996,7 +996,7 @@ static int coroutine_fn qcow_co_create_opts(const char *filename,
qobj = qdict_crumple(qdict, errp);
QDECREF(qdict);
- qdict = qobject_to_qdict(qobj);
+ qdict = qobject_to(QDict, qobj);
if (qdict == NULL) {
ret = -EINVAL;
goto fail;
diff --git a/block/qcow2.c b/block/qcow2.c
index 7472af6931..cf4f3becae 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -3125,7 +3125,7 @@ static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opt
/* Now get the QAPI type BlockdevCreateOptions */
qobj = qdict_crumple(qdict, errp);
QDECREF(qdict);
- qdict = qobject_to_qdict(qobj);
+ qdict = qobject_to(QDict, qobj);
if (qdict == NULL) {
ret = -EINVAL;
goto finish;
diff --git a/block/qed.c b/block/qed.c
index 46a84beeed..35ff505066 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -764,7 +764,7 @@ static int coroutine_fn bdrv_qed_co_create_opts(const char *filename,
qobj = qdict_crumple(qdict, errp);
QDECREF(qdict);
- qdict = qobject_to_qdict(qobj);
+ qdict = qobject_to(QDict, qobj);
if (qdict == NULL) {
ret = -EINVAL;
goto fail;
diff --git a/block/rbd.c b/block/rbd.c
index 294ed07ac4..5b64849dc6 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -263,14 +263,14 @@ static int qemu_rbd_set_keypairs(rados_t cluster, const char *keypairs_json,
if (!keypairs_json) {
return ret;
}
- keypairs = qobject_to_qlist(qobject_from_json(keypairs_json,
- &error_abort));
+ keypairs = qobject_to(QList,
+ qobject_from_json(keypairs_json, &error_abort));
remaining = qlist_size(keypairs) / 2;
assert(remaining);
while (remaining--) {
- name = qobject_to_qstring(qlist_pop(keypairs));
- value = qobject_to_qstring(qlist_pop(keypairs));
+ name = qobject_to(QString, qlist_pop(keypairs));
+ value = qobject_to(QString, qlist_pop(keypairs));
assert(name && value);
key = qstring_get_str(name);
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 797ea5953b..387f59c8aa 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1887,7 +1887,7 @@ static int sd_create_prealloc(BlockdevOptionsSheepdog *location, int64_t size,
return -EINVAL;
}
- qdict = qobject_to_qdict(obj);
+ qdict = qobject_to(QDict, obj);
qdict_flatten(qdict);
qdict_put_str(qdict, "driver", "sheepdog");
diff --git a/block/vhdx.c b/block/vhdx.c
index f1b97f4b49..d2c54b7891 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -1997,7 +1997,7 @@ static int coroutine_fn vhdx_co_create_opts(const char *filename,
qobj = qdict_crumple(qdict, errp);
QDECREF(qdict);
- qdict = qobject_to_qdict(qobj);
+ qdict = qobject_to(QDict, qobj);
if (qdict == NULL) {
ret = -EINVAL;
goto fail;
diff --git a/block/vpc.c b/block/vpc.c
index 28ffa0d2f8..44f99a4d1b 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -1120,7 +1120,7 @@ static int coroutine_fn vpc_co_create_opts(const char *filename,
qobj = qdict_crumple(qdict, errp);
QDECREF(qdict);
- qdict = qobject_to_qdict(qobj);
+ qdict = qobject_to(QDict, qobj);
if (qdict == NULL) {
ret = -EINVAL;
goto fail;