[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 45/53] hmp: Ignore Error objects where the return value suffices
From: |
Markus Armbruster |
Subject: |
[PULL 45/53] hmp: Ignore Error objects where the return value suffices |
Date: |
Tue, 7 Jul 2020 23:24:55 +0200 |
qdev_print_props() receives and throws away Error objects just to
check for object_property_get_str() and object_property_print()
failure. Unnecessary, both return suitable values, so use those
instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200707160613.848843-46-armbru@redhat.com>
---
qdev-monitor.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 96e52a9e81..31cc1f6564 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -694,22 +694,22 @@ static void qdev_print_props(Monitor *mon, DeviceState
*dev, Property *props,
if (!props)
return;
for (; props->name; props++) {
- Error *err = NULL;
char *value;
char *legacy_name = g_strdup_printf("legacy-%s", props->name);
+
if (object_property_get_type(OBJECT(dev), legacy_name, NULL)) {
- value = object_property_get_str(OBJECT(dev), legacy_name, &err);
+ value = object_property_get_str(OBJECT(dev), legacy_name, NULL);
} else {
- value = object_property_print(OBJECT(dev), props->name, true,
&err);
+ value = object_property_print(OBJECT(dev), props->name, true,
+ NULL);
}
g_free(legacy_name);
- if (err) {
- error_free(err);
+ if (!value) {
continue;
}
qdev_printf("%s = %s\n", props->name,
- value && *value ? value : "<null>");
+ *value ? value : "<null>");
g_free(value);
}
}
--
2.26.2
- [PULL 27/53] qom: Make functions taking Error ** return bool, not void, (continued)
- [PULL 27/53] qom: Make functions taking Error ** return bool, not void, Markus Armbruster, 2020/07/08
- [PULL 09/53] qemu-option: Factor out helper find_default_by_name(), Markus Armbruster, 2020/07/08
- [PULL 25/53] qom: Use return values to check for error where that's simpler, Markus Armbruster, 2020/07/08
- [PULL 35/53] error: Eliminate error_propagate() with Coccinelle, part 2, Markus Armbruster, 2020/07/08
- [PULL 19/53] qapi: Use returned bool to check for failure, manual part, Markus Armbruster, 2020/07/08
- [PULL 05/53] macio: Tidy up error handling in macio_newworld_realize(), Markus Armbruster, 2020/07/08
- [PULL 28/53] qom: Use returned bool to check for failure, Coccinelle part, Markus Armbruster, 2020/07/08
- [PULL 22/53] qom: Rename qdev_get_type() to object_get_type(), Markus Armbruster, 2020/07/08
- [PULL 41/53] qapi: Purge error_propagate() from QAPI core, Markus Armbruster, 2020/07/08
- [PULL 24/53] qom: Don't handle impossible object_property_get_link() failure, Markus Armbruster, 2020/07/08
- [PULL 45/53] hmp: Ignore Error objects where the return value suffices,
Markus Armbruster <=
- [PULL 16/53] hmp: Eliminate a variable in hmp_migrate_set_parameter(), Markus Armbruster, 2020/07/08
- [PULL 49/53] pflash: Use ERRP_GUARD(), Markus Armbruster, 2020/07/08
- [PULL 30/53] qom: Make functions taking Error ** return bool, not 0/-1, Markus Armbruster, 2020/07/08
- [PULL 46/53] error: New macro ERRP_GUARD(), Markus Armbruster, 2020/07/08
- [PULL 42/53] error: Avoid error_propagate() after migrate_add_blocker(), Markus Armbruster, 2020/07/08
- [PULL 47/53] scripts: Coccinelle script to use ERRP_GUARD(), Markus Armbruster, 2020/07/08
- [PULL 51/53] virtio-9p: Use ERRP_GUARD(), Markus Armbruster, 2020/07/08
- [PULL 13/53] qemu-option: Make functions taking Error ** return bool, not void, Markus Armbruster, 2020/07/08
- [PULL 11/53] qemu-option: Factor out helper opt_create(), Markus Armbruster, 2020/07/08
- [PULL 34/53] error: Eliminate error_propagate() with Coccinelle, part 1, Markus Armbruster, 2020/07/08