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>
This commit is contained in:
Max Reitz 2018-02-24 16:40:29 +01:00 committed by Eric Blake
parent 1a56b1e2ab
commit 7dc847ebba
51 changed files with 231 additions and 227 deletions

View file

@ -52,7 +52,7 @@ static QDict *qom_type_index(QList *types)
QListEntry *e;
QLIST_FOREACH_ENTRY(types, e) {
QDict *d = qobject_to_qdict(qlist_entry_obj(e));
QDict *d = qobject_to(QDict, qlist_entry_obj(e));
const char *name = qdict_get_str(d, "name");
QINCREF(d);
qdict_put(index, name, d);
@ -85,7 +85,7 @@ static QDict *type_list_find(QList *types, const char *name)
QListEntry *e;
QLIST_FOREACH_ENTRY(types, e) {
QDict *d = qobject_to_qdict(qlist_entry_obj(e));
QDict *d = qobject_to(QDict, qlist_entry_obj(e));
const char *ename = qdict_get_str(d, "name");
if (!strcmp(ename, name)) {
return d;
@ -151,7 +151,7 @@ static void test_qom_list_parents(const char *parent)
index = qom_type_index(types);
QLIST_FOREACH_ENTRY(types, e) {
QDict *d = qobject_to_qdict(qlist_entry_obj(e));
QDict *d = qobject_to(QDict, qlist_entry_obj(e));
const char *name = qdict_get_str(d, "name");
g_assert(qom_has_parent(index, name, parent));
@ -173,7 +173,7 @@ static void test_qom_list_fields(void)
non_abstract = qom_list_types(NULL, false);
QLIST_FOREACH_ENTRY(all_types, e) {
QDict *d = qobject_to_qdict(qlist_entry_obj(e));
QDict *d = qobject_to(QDict, qlist_entry_obj(e));
const char *name = qdict_get_str(d, "name");
bool abstract = qdict_haskey(d, "abstract") ?
qdict_get_bool(d, "abstract") :
@ -216,8 +216,8 @@ static void test_device_intro_concrete(void)
types = device_type_list(false);
QLIST_FOREACH_ENTRY(types, entry) {
type = qdict_get_try_str(qobject_to_qdict(qlist_entry_obj(entry)),
"name");
type = qdict_get_try_str(qobject_to(QDict, qlist_entry_obj(entry)),
"name");
g_assert(type);
test_one_device(type);
}
@ -238,7 +238,7 @@ static void test_abstract_interfaces(void)
index = qom_type_index(all_types);
QLIST_FOREACH_ENTRY(all_types, e) {
QDict *d = qobject_to_qdict(qlist_entry_obj(e));
QDict *d = qobject_to(QDict, qlist_entry_obj(e));
const char *name = qdict_get_str(d, "name");
/*