object_property_is_child() parses member @type to decide. Check the getter instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- include/qom/object.h | 1 + qom/object.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index dbfc29a2d6a..f43b13dfca7 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1886,6 +1886,7 @@ ObjectProperty *object_class_property_add_link(ObjectClass *oc, Object *val, Error **errp), ObjectPropertyLinkFlags flags); +bool object_property_is_child(ObjectProperty *prop); /** * object_resolve_and_typecheck: * @path: path to look up diff --git a/qom/object.c b/qom/object.c index 14fd2f3d17e..4a3c2a8f4a6 100644 --- a/qom/object.c +++ b/qom/object.c @@ -589,11 +589,6 @@ void object_initialize_child_internal(Object *parent, &error_abort, NULL); } -static inline bool object_property_is_child(ObjectProperty *prop) -{ - return strstart(prop->type, "child<", NULL); -} - static void object_property_del_all(Object *obj) { g_autoptr(GHashTable) done = g_hash_table_new(NULL, NULL); @@ -2159,6 +2154,15 @@ object_property_add_const_link(Object *obj, const char *name, NULL, OBJ_PROP_LINK_DIRECT); } +bool object_property_is_child(ObjectProperty *prop) +{ + if (prop->get == object_get_child_property) { + assert(prop->qom_type); + return true; + } + return false; +} + const char *object_get_canonical_path_component(const Object *obj) { ObjectProperty *prop = NULL; -- 2.55.0