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>
diff --git a/monitor.c b/monitor.c
index d92f02d..aeabb85 100644
--- a/monitor.c
+++ b/monitor.c
@@ -447,7 +447,7 @@
/* Unthrottled event */
monitor_qapi_event_emit(event, qdict);
} else {
- QDict *data = qobject_to_qdict(qdict_get(qdict, "data"));
+ QDict *data = qobject_to(QDict, qdict_get(qdict, "data"));
MonitorQAPIEventState key = { .event = event, .data = data };
evstate = g_hash_table_lookup(monitor_qapi_event_state, &key);
@@ -3777,7 +3777,7 @@
goto err_out;
}
- qdict = qobject_to_qdict(req);
+ qdict = qobject_to(QDict, req);
if (qdict) {
id = qdict_get(qdict, "id");
qobject_incref(id);
@@ -3793,7 +3793,7 @@
rsp = qmp_dispatch(cur_mon->qmp.commands, req);
if (mon->qmp.commands == &qmp_cap_negotiation_commands) {
- qdict = qdict_get_qdict(qobject_to_qdict(rsp), "error");
+ qdict = qdict_get_qdict(qobject_to(QDict, rsp), "error");
if (qdict
&& !g_strcmp0(qdict_get_try_str(qdict, "class"),
QapiErrorClass_str(ERROR_CLASS_COMMAND_NOT_FOUND))) {
@@ -3814,7 +3814,7 @@
if (rsp) {
if (id) {
- qdict_put_obj(qobject_to_qdict(rsp), "id", id);
+ qdict_put_obj(qobject_to(QDict, rsp), "id", id);
id = NULL;
}