mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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:
parent
1a56b1e2ab
commit
7dc847ebba
51 changed files with 231 additions and 227 deletions
|
@ -137,14 +137,14 @@ static void to_json(const QObject *obj, QString *str, int pretty, int indent)
|
|||
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 @@ static void to_json(const QObject *obj, QString *str, int pretty, int indent)
|
|||
}
|
||||
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 @@ static void to_json(const QObject *obj, QString *str, int pretty, int indent)
|
|||
}
|
||||
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 @@ static void to_json(const QObject *obj, QString *str, int pretty, int indent)
|
|||
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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue