diff options
author | Kevin Wolf <kwolf@redhat.com> | 2023-11-09 18:42:38 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2023-11-10 18:19:14 +0100 |
commit | 125062e791258c68109f3a59cb7aca3dadbdb5a3 (patch) | |
tree | e1bf572c3cdd665417572af3f3bbc72cd36191a0 /qom | |
parent | 670581f932d9415e843de8a5e31e041938248237 (diff) |
qom: Add object_property_set_default_list()
This function provides a default for properties that are accessed using
the list visitor interface. The default is always an empty list.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20231109174240.72376-10-kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qom')
-rw-r--r-- | qom/object.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c index 8557fe8e4e..95c0dc8285 100644 --- a/qom/object.c +++ b/qom/object.c @@ -31,6 +31,7 @@ * of the QOM core on QObject? */ #include "qom/qom-qobject.h" #include "qapi/qmp/qbool.h" +#include "qapi/qmp/qlist.h" #include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" #include "qemu/error-report.h" @@ -1588,6 +1589,11 @@ void object_property_set_default_str(ObjectProperty *prop, const char *value) object_property_set_default(prop, QOBJECT(qstring_from_str(value))); } +void object_property_set_default_list(ObjectProperty *prop) +{ + object_property_set_default(prop, QOBJECT(qlist_new())); +} + void object_property_set_default_int(ObjectProperty *prop, int64_t value) { object_property_set_default(prop, QOBJECT(qnum_from_int(value))); |