From 3650b2de3418daf38960a1d87f6ce1f1bf80183c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 4 Dec 2018 18:20:07 +0400 Subject: qom: make user_creatable_complete() specific to UserCreatable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Igor Mammedov Reviewed-by: Eduardo Habkost Message-Id: <20181204142023.15982-4-marcandre.lureau@redhat.com> Signed-off-by: Eduardo Habkost --- qom/object_interfaces.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'qom/object_interfaces.c') diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 97b79b48bb..db85d1eb75 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -8,18 +8,10 @@ #include "qapi/opts-visitor.h" #include "qemu/config-file.h" -void user_creatable_complete(Object *obj, Error **errp) +void user_creatable_complete(UserCreatable *uc, Error **errp) { + UserCreatableClass *ucc = USER_CREATABLE_GET_CLASS(uc); - UserCreatableClass *ucc; - UserCreatable *uc = - (UserCreatable *)object_dynamic_cast(obj, TYPE_USER_CREATABLE); - - if (!uc) { - return; - } - - ucc = USER_CREATABLE_GET_CLASS(uc); if (ucc->complete) { ucc->complete(uc, errp); } @@ -89,7 +81,7 @@ Object *user_creatable_add_type(const char *type, const char *id, goto out; } - user_creatable_complete(obj, &local_err); + user_creatable_complete(USER_CREATABLE(obj), &local_err); if (local_err) { object_property_del(object_get_objects_root(), id, &error_abort); -- cgit v1.2.3