[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/4] qmp: qom_type_get_info() helper
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 1/4] qmp: qom_type_get_info() helper |
Date: |
Tue, 26 Sep 2017 19:03:23 -0300 |
Extract the code that fills ObjectTypeInfo fields to a
qom_type_get_info() helper. It will be reused in other QMP
commands.
Signed-off-by: Eduardo Habkost <address@hidden>
---
qmp.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/qmp.c b/qmp.c
index e8c303116a..dec4bd843b 100644
--- a/qmp.c
+++ b/qmp.c
@@ -426,19 +426,25 @@ void qmp_change(const char *device, const char *target,
}
}
-static void qom_list_types_tramp(ObjectClass *klass, void *data)
+static void qom_type_get_info(ObjectClass *klass, ObjectTypeInfo *info)
{
- ObjectTypeInfoList *e, **pret = data;
- ObjectTypeInfo *info;
ObjectClass *parent = object_class_get_parent(klass);
- info = g_malloc0(sizeof(*info));
info->name = g_strdup(object_class_get_name(klass));
info->has_abstract = info->abstract = object_class_is_abstract(klass);
if (parent) {
info->has_parent = true;
info->parent = g_strdup(object_class_get_name(parent));
}
+}
+
+static void qom_list_types_tramp(ObjectClass *klass, void *data)
+{
+ ObjectTypeInfoList *e, **pret = data;
+ ObjectTypeInfo *info;
+
+ info = g_malloc0(sizeof(*info));
+ qom_type_get_info(klass, info);
e = g_malloc0(sizeof(*e));
e->value = info;
--
2.13.5