diff options
-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) |