qdict: Add qdict_put_null() helper, and put it to use

Backports relevant parts of commit 0f9afc2a8b5e78e511d79c936aa7b36deb3508bf from qemu
This commit is contained in:
Marc-André Lureau 2018-03-07 17:00:35 -05:00 committed by Lioncash
parent e1a055bd73
commit 101f763077
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -54,13 +54,15 @@ void qdict_destroy_obj(QObject *obj);
#define qdict_put(qdict, key, obj) \
qdict_put_obj(qdict, key, QOBJECT(obj))
/* Helpers for int, bool, and string */
/* 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())
/* High level helpers */
double qdict_get_double(const QDict *qdict, const char *key);