0bcc8e5b | 14-Jun-2018 |
Markus Armbruster <armbru@redhat.com> |
qobject: Move block-specific qdict code to block-qdict.c
Pure code motion, except for two brace placements and a comment tweaked to appease checkpatch.
Signed-off-by: Markus Armbruster <armbru@redh
qobject: Move block-specific qdict code to block-qdict.c
Pure code motion, except for two brace placements and a comment tweaked to appease checkpatch.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
show more ...
|
f5a74a5a | 19-Apr-2018 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qobject: Modify qobject_ref() to return obj
For convenience and clarity, make it possible to call qobject_ref() at the time when the reference is associated with a variable, or argument, by making q
qobject: Modify qobject_ref() to return obj
For convenience and clarity, make it possible to call qobject_ref() at the time when the reference is associated with a variable, or argument, by making qobject_ref() return the same pointer as given. Use that to simplify the callers.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180419150145.24795-5-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Useless change to qobject_ref_impl() dropped, commit message improved slightly] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
3d3eacae | 19-Apr-2018 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qobject: use a QObjectBase_ struct
By moving the base fields to a QObjectBase_, QObject can be a type which also has a 'base' field. This allows writing a generic QOBJECT() macro that will work with
qobject: use a QObjectBase_ struct
By moving the base fields to a QObjectBase_, QObject can be a type which also has a 'base' field. This allows writing a generic QOBJECT() macro that will work with any QObject type, including QObject itself. The container_of() macro ensures that the object to cast has a QObjectBase_ base field, giving some type safety guarantees. QObject must have no members but QObjectBase_ base, or else QOBJECT() breaks.
QObjectBase_ is not a typedef and uses a trailing underscore to make it obvious it is not for normal use and to avoid potential abuse.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180419150145.24795-3-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
b26ae1cb | 09-Mar-2018 |
Peter Xu <peterx@redhat.com> |
qobject: introduce qobject_get_try_str()
A quick way to fetch string from qobject when it's a QString.
Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Si
qobject: introduce qobject_get_try_str()
A quick way to fetch string from qobject when it's a QString.
Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180309090006.10018-4-peterx@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: rebase to qobject_to() macro] Signed-off-by: Eric Blake <eblake@redhat.com>
show more ...
|
532fb532 | 10-Mar-2018 |
Max Reitz <mreitz@redhat.com> |
qapi: Make more of qobject_to()
This patch reworks some places which use either qobject_type() checks plus qobject_to(), where the latter alone is sufficient, or NULL checks plus qobject_type() chec
qapi: Make more of qobject_to()
This patch reworks some places which use either qobject_type() checks plus qobject_to(), where the latter alone is sufficient, or NULL checks plus qobject_type() checks where we can simply do a qobject_to() != NULL check.
Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-Id: <20180224154033.29559-6-mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: rebase to qobject_to() parameter ordering] Signed-off-by: Eric Blake <eblake@redhat.com>
show more ...
|
7dc847eb | 24-Feb-2018 |
Max Reitz <mreitz@redhat.com> |
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_
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>
show more ...
|
15280c36 | 01-Feb-2018 |
Markus Armbruster <armbru@redhat.com> |
qdict qlist: Make most helper macros functions
The macro expansions of qdict_put_TYPE() and qlist_append_TYPE() need qbool.h, qnull.h, qnum.h and qstring.h to compile. We include qnull.h and qnum.h
qdict qlist: Make most helper macros functions
The macro expansions of qdict_put_TYPE() and qlist_append_TYPE() need qbool.h, qnull.h, qnum.h and qstring.h to compile. We include qnull.h and qnum.h in the headers, but not qbool.h and qstring.h. Works, because we include those wherever the macros get used.
Open-coding these helpers is of dubious value. Turn them into functions and drop the includes from the headers.
This cleanup makes the number of objects depending on qapi/qmp/qnum.h from 4551 (out of 4743) to 46 in my "build everything" tree. For qapi/qmp/qnull.h, the number drops from 4552 to 21.
Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180201111846.21846-10-armbru@redhat.com>
show more ...
|
cbb65405 | 25-Aug-2017 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qlit: Tighten QLit list vs QList comparison
We check that all members of the QLit list are also in the QList. We neglect to check the other direction. Fix that.
While there, use QLIST_FOREACH_ENT
qlit: Tighten QLit list vs QList comparison
We check that all members of the QLit list are also in the QList. We neglect to check the other direction. Fix that.
While there, use QLIST_FOREACH_ENTRY() to simplify the code and break the loop on the first mismatch.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170825105913.4060-13-marcandre.lureau@redhat.com> [Commit message improved] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
6da8a7a3 | 25-Aug-2017 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qlit: Tighten QLit dict vs QDict comparison
We check that all members of the QLit dictionary are also in the QDict. We neglect to check the other direction.
Comparing the number of members suffice
qlit: Tighten QLit dict vs QDict comparison
We check that all members of the QLit dictionary are also in the QDict. We neglect to check the other direction.
Comparing the number of members suffices, because QDict can't contain duplicate members, and putting duplicates in a QLit is a programming error.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170825105913.4060-12-marcandre.lureau@redhat.com> [Commit message improved] Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|
5f4bd809 | 25-Aug-2017 |
Marc-André Lureau <marcandre.lureau@redhat.com> |
qlit: Replace open-coded qnum_get_int() by call
Bonus: rids us of a side effect in an assertion.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbr
qlit: Replace open-coded qnum_get_int() by call
Bonus: rids us of a side effect in an assertion.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170825105913.4060-10-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
show more ...
|