[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/30] qom: allow object_get_canonical_path_component
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 05/30] qom: allow object_get_canonical_path_component without parent |
Date: |
Wed, 9 May 2018 00:14:22 +0200 |
Just return NULL; any callers that cause a change in behavior
would have caused an assertion failure before, so this is safe.
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/qom/object.h | 1 +
qom/object.c | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index 96ce81b..a0c78c7 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1302,6 +1302,7 @@ Object *object_get_internal_root(void);
*
* Returns: The final component in the object's canonical path. The canonical
* path is the path within the composition tree starting from the root.
+ * %NULL if the object doesn't have a parent (and thus a canonical path).
*/
gchar *object_get_canonical_path_component(Object *obj);
diff --git a/qom/object.c b/qom/object.c
index 76a89af..0fc9720 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1644,8 +1644,9 @@ gchar *object_get_canonical_path_component(Object *obj)
ObjectProperty *prop = NULL;
GHashTableIter iter;
- g_assert(obj);
- g_assert(obj->parent != NULL);
+ if (obj->parent == NULL) {
+ return NULL;
+ }
g_hash_table_iter_init(&iter, obj->parent->properties);
while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&prop)) {
--
1.8.3.1
- [Qemu-devel] [PULL 00/30] Misc patches for 2018-05-09, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 01/30] configure: recognize more rpmbuild macros, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 03/30] cpus: tcg: fix never exiting loop on unplug, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 02/30] cpus: Fix event order on resume of stopped guest, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 04/30] checkpatch.pl: add common glib defines to typelist, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 06/30] memdev: remove "id" property, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 05/30] qom: allow object_get_canonical_path_component without parent,
Paolo Bonzini <=
- [Qemu-devel] [PULL 09/30] exec: extract address_space_translate_iommu, fix page_mask corner case, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 08/30] exec: small changes to flatview_do_translate, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 10/30] exec: reintroduce MemoryRegion caching, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 11/30] qemu-thread: always keep the posix wrapper layer, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 12/30] update-linux-headers: drop hyperv.h, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 07/30] exec: move memory access declarations to a common header, inline *_phys functions, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 13/30] accel: use g_strsplit for parsing accelerator names, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 14/30] opts: don't silently truncate long parameter keys, Paolo Bonzini, 2018/05/08
- [Qemu-devel] [PULL 17/30] qemu-options: Mark -virtioconsole as deprecated, Paolo Bonzini, 2018/05/08