diff --git a/block/qapi.c b/block/qapi.c index 1ab437251927220217d6040ea1b9c3b0faba2461..1e0cb2743d2770a5ee0520e1902cd61d354dfc78 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -32,6 +32,7 @@ #include "qapi/error.h" #include "qapi/qobject-output-visitor.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" #include "sysemu/block-backend.h" #include "qemu/cutils.h" diff --git a/blockdev.c b/blockdev.c index 8a474599379756ff57d41630ca64032f781ad553..c487cf0e4b72fa75c4bc4b97773e4de0e6e5875a 100644 --- a/blockdev.c +++ b/blockdev.c @@ -40,6 +40,7 @@ #include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/config-file.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" #include "qapi-visit.h" #include "qapi/error.h" diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index ed78c4ed9f1daba51c85d61931465b0118006ebe..deb440f286347eef0f8034b431f5ef581fbec9a3 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -22,6 +22,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qmp/qnum.h" #include "acpi-build.h" #include "qemu-common.h" #include "qemu/bitmap.h" diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index e3b122968e89c99cd75557b6e45255873909ebf2..aa251133dec14647d19b40436315cdeb6e636080 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qmp/qnull.h" #include "cpu.h" #include "qemu/cutils.h" #include "hw/ppc/spapr_drc.h" diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h index d0c298114e750f5b6ccbaea1cef59bc8676dadce..3c1def00f736d5be0219b4b4d2ae86289e8d8176 100644 --- a/include/qapi/qmp/qdict.h +++ b/include/qapi/qmp/qdict.h @@ -15,8 +15,6 @@ #include "qapi/qmp/qobject.h" #include "qapi/qmp/qlist.h" -#include "qapi/qmp/qnull.h" -#include "qapi/qmp/qnum.h" #include "qemu/queue.h" #define QDICT_BUCKET_MAX 512 @@ -55,17 +53,11 @@ void qdict_destroy_obj(QObject *obj); #define qdict_put(qdict, key, obj) \ qdict_put_obj(qdict, key, QOBJECT(obj)) -/* Helpers for int, bool, null, and string */ -#define qdict_put_int(qdict, key, value) \ - qdict_put(qdict, key, qnum_from_int(value)) -#define qdict_put_bool(qdict, key, value) \ - qdict_put(qdict, key, qbool_from_bool(value)) -#define qdict_put_str(qdict, key, value) \ - qdict_put(qdict, key, qstring_from_str(value)) -#define qdict_put_null(qdict, key) \ - qdict_put(qdict, key, qnull()) +void qdict_put_bool(QDict *qdict, const char *key, bool value); +void qdict_put_int(QDict *qdict, const char *key, int64_t value); +void qdict_put_null(QDict *qdict, const char *key); +void qdict_put_str(QDict *qdict, const char *key, const char *value); -/* High level helpers */ double qdict_get_double(const QDict *qdict, const char *key); int64_t qdict_get_int(const QDict *qdict, const char *key); bool qdict_get_bool(const QDict *qdict, const char *key); diff --git a/include/qapi/qmp/qlist.h b/include/qapi/qmp/qlist.h index 632b7ef2c153b180edbb99fc960216f5554c6905..5fd976a3981e2d2e4505cd57332f54bb673312aa 100644 --- a/include/qapi/qmp/qlist.h +++ b/include/qapi/qmp/qlist.h @@ -14,8 +14,6 @@ #define QLIST_H #include "qapi/qmp/qobject.h" -#include "qapi/qmp/qnum.h" -#include "qapi/qmp/qnull.h" #include "qemu/queue.h" typedef struct QListEntry { @@ -31,15 +29,10 @@ struct QList { #define qlist_append(qlist, obj) \ qlist_append_obj(qlist, QOBJECT(obj)) -/* Helpers for int, bool, and string */ -#define qlist_append_int(qlist, value) \ - qlist_append(qlist, qnum_from_int(value)) -#define qlist_append_bool(qlist, value) \ - qlist_append(qlist, qbool_from_bool(value)) -#define qlist_append_str(qlist, value) \ - qlist_append(qlist, qstring_from_str(value)) -#define qlist_append_null(qlist) \ - qlist_append(qlist, qnull()) +void qlist_append_bool(QList *qlist, bool value); +void qlist_append_int(QList *qlist, int64_t value); +void qlist_append_null(QList *qlist); +void qlist_append_str(QList *qlist, const char *value); #define QLIST_FOREACH_ENTRY(qlist, var) \ for ((var) = ((qlist)->head.tqh_first); \ diff --git a/migration/migration.c b/migration/migration.c index 274160e9700da78dd73ecd91e6571ec8c5008528..86d69120a62b8f584002a42933ba90f2501348ae 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -32,6 +32,7 @@ #include "block/block.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" +#include "qapi/qmp/qnull.h" #include "qemu/rcu.h" #include "block.h" #include "postcopy-ram.h" diff --git a/monitor.c b/monitor.c index f38640c1e46dcd387efa54a0efbbcb23a68cd728..20f7b159b3976f2321712807d1daf6473f58b97f 100644 --- a/monitor.c +++ b/monitor.c @@ -54,6 +54,7 @@ #include "sysemu/tpm.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qjson.h" #include "qapi/qmp/json-streamer.h" #include "qapi/qmp/json-parser.h" diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c index c7d5f80302c60118aa75a0dd926a3dce81a5afb3..fd2380316622410de9c810ad0700fd3b8acc79bb 100644 --- a/qapi/qapi-dealloc-visitor.c +++ b/qapi/qapi-dealloc-visitor.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "qapi/dealloc-visitor.h" +#include "qapi/qmp/qnull.h" #include "qemu/queue.h" #include "qemu-common.h" #include "qapi/visitor-impl.h" diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c index 8fb34c472e1011b960aadd434d393a536568f7bb..31183dcb6290080d8db3c7df70d2e5d24d8bb694 100644 --- a/qapi/qobject-input-visitor.c +++ b/qapi/qobject-input-visitor.c @@ -22,6 +22,8 @@ #include "qapi/qmp/qjson.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qerror.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" #include "qemu/cutils.h" #include "qemu/option.h" diff --git a/qapi/qobject-output-visitor.c b/qapi/qobject-output-visitor.c index 60398765df0de48f78db6e0272a3105d0ba6169c..f0cc46b3cf82dcb8bd87a52aede2c12bf1a0d875 100644 --- a/qapi/qobject-output-visitor.c +++ b/qapi/qobject-output-visitor.c @@ -18,6 +18,8 @@ #include "qemu/queue.h" #include "qemu-common.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" typedef struct QStackEntry { diff --git a/qobject/json-parser.c b/qobject/json-parser.c index 30dfb9dc4117268ee336e22780d85da62cf443fa..8f4badc6d9957eab2e1385799855fff23d2ba501 100644 --- a/qobject/json-parser.c +++ b/qobject/json-parser.c @@ -16,6 +16,8 @@ #include "qapi/error.h" #include "qemu-common.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" #include "qapi/qmp/json-parser.h" #include "qapi/qmp/json-lexer.h" diff --git a/qobject/qdict.c b/qobject/qdict.c index e8f15f113244293e3a37c2530883c920865e8a45..7e7ac24cf7e8eb046f1fc56efad30a4ca87900d0 100644 --- a/qobject/qdict.c +++ b/qobject/qdict.c @@ -14,6 +14,7 @@ #include "qapi/qmp/qnum.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnull.h" #include "qapi/qmp/qstring.h" #include "qapi/qmp/qobject.h" #include "qapi/error.h" @@ -143,6 +144,26 @@ void qdict_put_obj(QDict *qdict, const char *key, QObject *value) } } +void qdict_put_int(QDict *qdict, const char *key, int64_t value) +{ + qdict_put(qdict, key, qnum_from_int(value)); +} + +void qdict_put_bool(QDict *qdict, const char *key, bool value) +{ + qdict_put(qdict, key, qbool_from_bool(value)); +} + +void qdict_put_str(QDict *qdict, const char *key, const char *value) +{ + qdict_put(qdict, key, qstring_from_str(value)); +} + +void qdict_put_null(QDict *qdict, const char *key) +{ + qdict_put(qdict, key, qnull()); +} + /** * qdict_get(): Lookup for a given 'key' * diff --git a/qobject/qjson.c b/qobject/qjson.c index fe892132474fd902ea119146d97eed7412beeb05..7fbb68b6ba5ef029cb314440212c94ed59f79848 100644 --- a/qobject/qjson.c +++ b/qobject/qjson.c @@ -18,6 +18,7 @@ #include "qapi/qmp/json-streamer.h" #include "qapi/qmp/qjson.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnum.h" #include "qemu/unicode.h" typedef struct JSONParsingState diff --git a/qobject/qlist.c b/qobject/qlist.c index 3ef57d31d14ff844861f1d38a046965381d02dba..268e46c8f09ff1a9bb9084baf6af15626d3ff34e 100644 --- a/qobject/qlist.c +++ b/qobject/qlist.c @@ -11,8 +11,12 @@ */ #include "qemu/osdep.h" +#include "qapi/qmp/qbool.h" #include "qapi/qmp/qlist.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qobject.h" +#include "qapi/qmp/qstring.h" #include "qemu/queue.h" #include "qemu-common.h" @@ -64,6 +68,26 @@ void qlist_append_obj(QList *qlist, QObject *value) QTAILQ_INSERT_TAIL(&qlist->head, entry, next); } +void qlist_append_int(QList *qlist, int64_t value) +{ + qlist_append(qlist, qnum_from_int(value)); +} + +void qlist_append_bool(QList *qlist, bool value) +{ + qlist_append(qlist, qbool_from_bool(value)); +} + +void qlist_append_str(QList *qlist, const char *value) +{ + qlist_append(qlist, qstring_from_str(value)); +} + +void qlist_append_null(QList *qlist) +{ + qlist_append(qlist, qnull()); +} + /** * qlist_iter(): Iterate over all the list's stored values. * diff --git a/qobject/qlit.c b/qobject/qlit.c index dbf19225c8101051276f31d792d27072c86f3663..c2d0303425d179a93385eb51849e513fb84a49c7 100644 --- a/qobject/qlit.c +++ b/qobject/qlit.c @@ -17,6 +17,7 @@ #include "qapi/qmp/qlit.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" diff --git a/qobject/qobject.c b/qobject/qobject.c index 9b61ece06b34587ae651c9cb25883d4fc8496d94..5bbcd0481283ee530138e66d26e1df9b08186767 100644 --- a/qobject/qobject.c +++ b/qobject/qobject.c @@ -10,6 +10,8 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" diff --git a/qom/object.c b/qom/object.c index c58c52d518b16da2db93feee27e1633b1fc572d1..d97f09c1fb5f2567c7659dbe726fd50b67ff8e8a 100644 --- a/qom/object.c +++ b/qom/object.c @@ -27,6 +27,7 @@ #include "qom/qom-qobject.h" #include "qapi/qmp/qobject.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" #define MAX_INTERFACES 32 diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 4132f67bb1f77fca43ea0b47e1b25dd17834622e..eeaad9e91f1bbccfd5c150e3302471f50612ae97 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -24,6 +24,7 @@ #include "disas/disas.h" #include "exec/exec-all.h" #include "tcg-op.h" +#include "qapi/qmp/qnull.h" #include "qemu/host-utils.h" #include "exec/cpu_ldst.h" diff --git a/tests/check-qdict.c b/tests/check-qdict.c index 35405778ccfac9d8cf0444bd085094bc2bdbdbad..1b1173634f3c447fe7586366f6ee3b1c3860e45b 100644 --- a/tests/check-qdict.c +++ b/tests/check-qdict.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qapi/qmp/qdict.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" #include "qapi/error.h" #include "qemu-common.h" diff --git a/tests/check-qjson.c b/tests/check-qjson.c index 7881009f1c516f90e1609f10d66f62ae943b20f4..26f5d4401e77b0e769572c6e2dd86d8b95ffc64c 100644 --- a/tests/check-qjson.c +++ b/tests/check-qjson.c @@ -17,6 +17,8 @@ #include "qapi/qmp/qbool.h" #include "qapi/qmp/qjson.h" #include "qapi/qmp/qlit.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" #include "qemu-common.h" static void escaped_string(void) diff --git a/tests/check-qobject.c b/tests/check-qobject.c index 06b9c6ec34a2023c11b4da21f2f070efb44e717c..9e1e82045fe463955295d00e44bb95e353a4aa4d 100644 --- a/tests/check-qobject.c +++ b/tests/check-qobject.c @@ -9,6 +9,8 @@ #include "qemu/osdep.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" #include "qemu-common.h" diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c index 4794d1a9d8c34dbfd9a7a2628a5d73f6cadf20d4..b5a3d88775fdfcb6fecf580570468aa9f8422c2e 100644 --- a/tests/test-qmp-commands.c +++ b/tests/test-qmp-commands.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qapi/qmp/qdict.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" #include "test-qmp-commands.h" #include "qapi/error.h" diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c index b197dff45352f257be8cbcd905ddefabd0f9645b..cad94778c7b56c25e47d17a140e3c0b9a04e9992 100644 --- a/tests/test-qmp-event.c +++ b/tests/test-qmp-event.c @@ -18,6 +18,7 @@ #include "test-qapi-event.h" #include "qapi/error.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qobject.h" #include "qapi/qmp/qstring.h" #include "qapi/qmp-event.h" diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c index 96405991bb0c6a8eb63bb072c55088d3f22c17e3..20bf9a54140c80e5fca9c1065d6c862cb8c7ba62 100644 --- a/tests/test-qobject-input-visitor.c +++ b/tests/test-qobject-input-visitor.c @@ -18,6 +18,8 @@ #include "qapi/qobject-input-visitor.h" #include "test-qapi-visit.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qjson.h" #include "test-qmp-introspect.h" #include "qmp-introspect.h" diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-output-visitor.c index a0b7fe6addb48d74a6356aa067e581444a3cd2c2..4a24e12121c84a55925a6f7e631650db4ed697fd 100644 --- a/tests/test-qobject-output-visitor.c +++ b/tests/test-qobject-output-visitor.c @@ -17,6 +17,8 @@ #include "qapi/qobject-output-visitor.h" #include "test-qapi-visit.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qjson.h" typedef struct TestOutputVisitorData { diff --git a/util/qemu-option.c b/util/qemu-option.c index d790c1b85a7c636e3e674d52f3132e2b40a490e6..a401e936daf65f198a74530aa2ff030559406e56 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -30,6 +30,7 @@ #include "qemu/error-report.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qdict.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" #include "qapi/qmp/qerror.h" #include "qemu/option_int.h"