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/qobject/qjson.c b/qobject/qjson.c
index e1ce756..655d38a 100644
--- a/qobject/qjson.c
+++ b/qobject/qjson.c
@@ -137,14 +137,14 @@
qstring_append(str, "null");
break;
case QTYPE_QNUM: {
- QNum *val = qobject_to_qnum(obj);
+ QNum *val = qobject_to(QNum, obj);
char *buffer = qnum_to_string(val);
qstring_append(str, buffer);
g_free(buffer);
break;
}
case QTYPE_QSTRING: {
- QString *val = qobject_to_qstring(obj);
+ QString *val = qobject_to(QString, obj);
const char *ptr;
int cp;
char buf[16];
@@ -201,7 +201,7 @@
}
case QTYPE_QDICT: {
ToJsonIterState s;
- QDict *val = qobject_to_qdict(obj);
+ QDict *val = qobject_to(QDict, obj);
s.count = 0;
s.str = str;
@@ -220,7 +220,7 @@
}
case QTYPE_QLIST: {
ToJsonIterState s;
- QList *val = qobject_to_qlist(obj);
+ QList *val = qobject_to(QList, obj);
s.count = 0;
s.str = str;
@@ -238,7 +238,7 @@
break;
}
case QTYPE_QBOOL: {
- QBool *val = qobject_to_qbool(obj);
+ QBool *val = qobject_to(QBool, obj);
if (qbool_get_bool(val)) {
qstring_append(str, "true");