@@ -457,14 +457,14 @@ struct Object
* assumed to be the size of the parent class. This allows a type to avoid
* implementing an explicit class type if they are not adding additional
* virtual functions.
- * @class_init: This function is called after all parent class initialization
- * has occurred to allow a class to set its default virtual method pointers.
- * This is also the function to use to override virtual methods from a parent
- * class.
* @class_base_init: This function is called for all base classes after all
* parent class initialization has occurred, but before the class itself
* is initialized. This is the function to use to undo the effects of
* memcpy from the parent class to the descendants.
+ * @class_init: This function is called after all parent class initialization
+ * has occurred to allow a class to set its default virtual method pointers.
+ * This is also the function to use to override virtual methods from a parent
+ * class.
* @class_data: Data to pass to the @class_init,
* @class_base_init. This can be useful when building dynamic
* classes.
@@ -486,8 +486,8 @@ struct TypeInfo
bool abstract;
size_t class_size;
- void (*class_init)(ObjectClass *klass, void *data);
void (*class_base_init)(ObjectClass *klass, void *data);
+ void (*class_init)(ObjectClass *klass, void *data);
void *class_data;
InterfaceInfo *interfaces;
@@ -54,8 +54,8 @@ struct TypeImpl
size_t instance_size;
size_t instance_align;
- void (*class_init)(ObjectClass *klass, void *data);
void (*class_base_init)(ObjectClass *klass, void *data);
+ void (*class_init)(ObjectClass *klass, void *data);
void *class_data;
@@ -119,8 +119,8 @@ static TypeImpl *type_new(const TypeInfo *info)
ti->instance_size = info->instance_size;
ti->instance_align = info->instance_align;
- ti->class_init = info->class_init;
ti->class_base_init = info->class_base_init;
+ ti->class_init = info->class_init;
ti->class_data = info->class_data;
ti->instance_init = info->instance_init;
@@ -486,8 +486,8 @@ pub trait ObjectImpl: ObjectType + ClassInitImpl<Self::Class> {
instance_finalize: Some(drop_object::<Self>),
abstract_: Self::ABSTRACT,
class_size: core::mem::size_of::<Self::Class>(),
- class_init: Some(rust_class_init::<Self>),
class_base_init: Self::CLASS_BASE_INIT,
+ class_init: Some(rust_class_init::<Self>),
class_data: core::ptr::null_mut(),
interfaces: core::ptr::null_mut(),
};
Since class_base_init() is called *before* class_init(), move its declaration in TypeInfo before class_init() to help a bit. No logical change. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/qom/object.h | 10 +++++----- qom/object.c | 4 ++-- rust/qemu-api/src/qom.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)