diff options
author | Eric Blake | 2021-01-13 23:10:10 +0100 |
---|---|---|
committer | Markus Armbruster | 2021-01-28 08:08:45 +0100 |
commit | 240ee8bd31f7ff7407197588ae800ff554758b4d (patch) | |
tree | a5025106cb2effe7fcb6cdf6d05040527c1d4118 | |
parent | net: Clarify early exit condition (diff) | |
download | qemu-240ee8bd31f7ff7407197588ae800ff554758b4d.tar.gz qemu-240ee8bd31f7ff7407197588ae800ff554758b4d.tar.xz qemu-240ee8bd31f7ff7407197588ae800ff554758b4d.zip |
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>
-rw-r--r-- | hw/core/machine-qmp-cmds.c | 34 | ||||
-rw-r--r-- | monitor/qmp-cmds-control.c | 9 |
2 files changed, 16 insertions, 27 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; diff --git a/monitor/qmp-cmds-control.c b/monitor/qmp-cmds-control.c index 17514f4959..509ae870bd 100644 --- a/monitor/qmp-cmds-control.c +++ b/monitor/qmp-cmds-control.c @@ -104,17 +104,16 @@ VersionInfo *qmp_query_version(Error **errp) static void query_commands_cb(const QmpCommand *cmd, void *opaque) { - CommandInfoList *info, **list = opaque; + CommandInfo *info; + CommandInfoList **list = opaque; if (!cmd->enabled) { return; } info = g_malloc0(sizeof(*info)); - info->value = g_malloc0(sizeof(*info->value)); - info->value->name = g_strdup(cmd->name); - info->next = *list; - *list = info; + info->name = g_strdup(cmd->name); + QAPI_LIST_PREPEND(*list, info); } CommandInfoList *qmp_query_commands(Error **errp) |