diff options
author | Eric Blake <eblake@redhat.com> | 2021-01-13 16:10:10 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-01-28 08:08:45 +0100 |
commit | 240ee8bd31f7ff7407197588ae800ff554758b4d (patch) | |
tree | a5025106cb2effe7fcb6cdf6d05040527c1d4118 /hw | |
parent | e9d635ea1809a6e114c33413c359abbb88a35737 (diff) |
qapi: A couple more QAPI_LIST_PREPEND() stragglers
Commit 54aa3de72e switched multiple sites to use QAPI_LIST_PREPEND
instead of open-coding, but missed a couple of spots.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210113221013.390592-3-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/core/machine-qmp-cmds.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index affffe0c4a..156223a344 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -293,41 +293,31 @@ void qmp_set_numa_node(NumaOptions *cmd, Error **errp) static int query_memdev(Object *obj, void *opaque) { MemdevList **list = opaque; - MemdevList *m = NULL; + Memdev *m; QObject *host_nodes; Visitor *v; if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) { m = g_malloc0(sizeof(*m)); - m->value = g_malloc0(sizeof(*m->value)); - - m->value->id = g_strdup(object_get_canonical_path_component(obj)); - m->value->has_id = !!m->value->id; - - m->value->size = object_property_get_uint(obj, "size", - &error_abort); - m->value->merge = object_property_get_bool(obj, "merge", - &error_abort); - m->value->dump = object_property_get_bool(obj, "dump", - &error_abort); - m->value->prealloc = object_property_get_bool(obj, - "prealloc", - &error_abort); - m->value->policy = object_property_get_enum(obj, - "policy", - "HostMemPolicy", - &error_abort); + m->id = g_strdup(object_get_canonical_path_component(obj)); + m->has_id = !!m->id; + + m->size = object_property_get_uint(obj, "size", &error_abort); + m->merge = object_property_get_bool(obj, "merge", &error_abort); + m->dump = object_property_get_bool(obj, "dump", &error_abort); + m->prealloc = object_property_get_bool(obj, "prealloc", &error_abort); + m->policy = object_property_get_enum(obj, "policy", "HostMemPolicy", + &error_abort); host_nodes = object_property_get_qobject(obj, "host-nodes", &error_abort); v = qobject_input_visitor_new(host_nodes); - visit_type_uint16List(v, NULL, &m->value->host_nodes, &error_abort); + visit_type_uint16List(v, NULL, &m->host_nodes, &error_abort); visit_free(v); qobject_unref(host_nodes); - m->next = *list; - *list = m; + QAPI_LIST_PREPEND(*list, m); } return 0; |