diff --git a/qemu/header_gen.py b/qemu/header_gen.py index a768cc74..757c7426 100644 --- a/qemu/header_gen.py +++ b/qemu/header_gen.py @@ -2749,7 +2749,11 @@ symbols = ( 'qdict_new', 'qdict_next', 'qdict_next_entry', + 'qdict_put_bool', + 'qdict_put_int', + 'qdict_put_null', 'qdict_put_obj', + 'qdict_put_str', 'qdict_size', 'qdict_type', 'qemu_clock_get_us', @@ -2803,7 +2807,11 @@ symbols = ( 'qint_from_int', 'qint_get_int', 'qint_type', + 'qlist_append_bool', + 'qlist_append_int', + 'qlist_append_null', 'qlist_append_obj', + 'qlist_append_str', 'qlist_copy', 'qlist_copy_elem', 'qlist_destroy_obj', diff --git a/qemu/include/qapi/qmp/qdict.h b/qemu/include/qapi/qmp/qdict.h index 3e3622be..7befc535 100644 --- a/qemu/include/qapi/qmp/qdict.h +++ b/qemu/include/qapi/qmp/qdict.h @@ -54,15 +54,10 @@ 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); diff --git a/qemu/include/qapi/qmp/qlist.h b/qemu/include/qapi/qmp/qlist.h index 6953ae81..112a086e 100644 --- a/qemu/include/qapi/qmp/qlist.h +++ b/qemu/include/qapi/qmp/qlist.h @@ -30,13 +30,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)) +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/qemu/qapi/qapi-dealloc-visitor.c b/qemu/qapi/qapi-dealloc-visitor.c index 9074f32f..b5b05cd2 100644 --- a/qemu/qapi/qapi-dealloc-visitor.c +++ b/qemu/qapi/qapi-dealloc-visitor.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "qapi/error.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/qemu/qapi/qobject-input-visitor.c b/qemu/qapi/qobject-input-visitor.c index fccd12c9..5f04400c 100644 --- a/qemu/qapi/qobject-input-visitor.c +++ b/qemu/qapi/qobject-input-visitor.c @@ -21,6 +21,8 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" #include "qapi/qmp/qerror.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" typedef struct StackObject { diff --git a/qemu/qapi/qobject-output-visitor.c b/qemu/qapi/qobject-output-visitor.c index 5f3f2a51..c1d3e673 100644 --- a/qemu/qapi/qobject-output-visitor.c +++ b/qemu/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/qdict.h" #include "qapi/qmp/qlist.h" #include "qapi/qmp/qstring.h" diff --git a/qemu/qobject/qdict.c b/qemu/qobject/qdict.c index 46dfd599..04604c8f 100644 --- a/qemu/qobject/qdict.c +++ b/qemu/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/qemu/qobject/qlist.c b/qemu/qobject/qlist.c index 1ec74de2..b9972d4b 100644 --- a/qemu/qobject/qlist.c +++ b/qemu/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/qemu/qobject/qobject.c b/qemu/qobject/qobject.c index d438b11e..d1fbe2f8 100644 --- a/qemu/qobject/qobject.c +++ b/qemu/qobject/qobject.c @@ -9,6 +9,8 @@ #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/qlist.h" #include "qapi/qmp/qstring.h"