[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 3/6] qmp: qmp_qom_list_properties(): ignore empty
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v3 3/6] qmp: qmp_qom_list_properties(): ignore empty string options |
Date: |
Fri, 17 May 2019 09:45:16 +0200 |
Current QAPI semantics return empty "" string in case string property
value hasn't been set (i.e. NULL). Do not show initial value in this
case in "qom-list-properties" command output to reduce clutter.
Signed-off-by: Igor Mammedov <address@hidden>
---
qmp.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/qmp.c b/qmp.c
index 8415541..463c7d4 100644
--- a/qmp.c
+++ b/qmp.c
@@ -41,6 +41,7 @@
#include "qom/object_interfaces.h"
#include "hw/mem/memory-device.h"
#include "hw/acpi/acpi_dev_interface.h"
+#include "qapi/qmp/qstring.h"
NameInfo *qmp_query_name(Error **errp)
{
@@ -596,7 +597,16 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char
*typename,
if (obj) {
info->q_default =
object_property_get_qobject(obj, info->name, NULL);
- info->has_q_default = !!info->q_default;
+ if (info->q_default) {
+ if (qobject_type(info->q_default) == QTYPE_QSTRING) {
+ QString *value = qobject_to(QString, info->q_default);
+ if (!strcmp(qstring_get_str(value), "")) {
+ qobject_unref(info->q_default);
+ info->q_default = NULL;
+ }
+ }
+ info->has_q_default = !!info->q_default;
+ }
}
entry = g_malloc0(sizeof(*entry));
--
2.7.4
- [Qemu-devel] [PATCH v3 0/6] numa: deprecate '-numa node, mem' and default memory distribution, Igor Mammedov, 2019/05/17
- [Qemu-devel] [PATCH v3 1/6] pc: fix possible NULL pointer dereference in pc_machine_get_device_memory_region_size(), Igor Mammedov, 2019/05/17
- [Qemu-devel] [PATCH v3 2/6] qmp: make "qom-list-properties" show initial property values, Igor Mammedov, 2019/05/17
- [Qemu-devel] [PATCH v3 3/6] qmp: qmp_qom_list_properties(): ignore empty string options,
Igor Mammedov <=
- [Qemu-devel] [PATCH v3 4/6] numa: introduce "numa-mem-supported" machine property, Igor Mammedov, 2019/05/17
- [Qemu-devel] [PATCH v3 5/6] numa: deprecate 'mem' parameter of '-numa node' option, Igor Mammedov, 2019/05/17
- [Qemu-devel] [PATCH v3 6/6] numa: deprecate implict memory distribution between nodes, Igor Mammedov, 2019/05/17