diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-12-04 18:20:07 +0400 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2018-12-11 15:45:22 -0200 |
commit | 3650b2de3418daf38960a1d87f6ce1f1bf80183c (patch) | |
tree | 0c1ab4967bfd17df8ce7e50f8e4dabab7a89a533 /qom/object.c | |
parent | aa1b35b975d83a1ee3b5d1a1ae200a59ca44f8d2 (diff) |
qom: make user_creatable_complete() specific to UserCreatable
Instead of accepting any Object*, change user_creatable_complete() to
require a UserCreatable*. Modify the callers to pass the appropriate
argument, removing redundant dynamic cast checks in object creation.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20181204142023.15982-4-marcandre.lureau@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'qom/object.c')
-rw-r--r-- | qom/object.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/qom/object.c b/qom/object.c index 547dcf97c3..eb770dbf7f 100644 --- a/qom/object.c +++ b/qom/object.c @@ -417,6 +417,7 @@ void object_initialize_childv(Object *parentobj, const char *propname, { Error *local_err = NULL; Object *obj; + UserCreatable *uc; object_initialize(childobj, size, type); obj = OBJECT(childobj); @@ -431,8 +432,9 @@ void object_initialize_childv(Object *parentobj, const char *propname, goto out; } - if (object_dynamic_cast(obj, TYPE_USER_CREATABLE)) { - user_creatable_complete(obj, &local_err); + uc = (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE); + if (uc) { + user_creatable_complete(uc, &local_err); if (local_err) { object_unparent(obj); goto out; @@ -590,6 +592,7 @@ Object *object_new_with_propv(const char *typename, Object *obj; ObjectClass *klass; Error *local_err = NULL; + UserCreatable *uc; klass = object_class_by_name(typename); if (!klass) { @@ -612,8 +615,9 @@ Object *object_new_with_propv(const char *typename, goto error; } - if (object_dynamic_cast(obj, TYPE_USER_CREATABLE)) { - user_creatable_complete(obj, &local_err); + uc = (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE); + if (uc) { + user_creatable_complete(uc, &local_err); if (local_err) { object_unparent(obj); goto error; |