diff options
author | Eduardo Habkost | 2020-09-16 20:25:16 +0200 |
---|---|---|
committer | Eduardo Habkost | 2020-09-18 20:12:32 +0200 |
commit | c734cd40a10943753a4d015c9d0a6c08c8f0159e (patch) | |
tree | f3a0e5e0152e85da0f0d0bc4bb48eef2198867c4 /include/qom | |
parent | scripts/codeconverter: Update to latest version (diff) | |
download | qemu-c734cd40a10943753a4d015c9d0a6c08c8f0159e.tar.gz qemu-c734cd40a10943753a4d015c9d0a6c08c8f0159e.tar.xz qemu-c734cd40a10943753a4d015c9d0a6c08c8f0159e.zip |
qom: Remove ParentClassType argument from OBJECT_DECLARE_SIMPLE_TYPE
The requirement to specify the parent class type makes the macro
harder to use and easy to misuse (silent bugs can be introduced
if the wrong struct type is specified).
Simplify the macro by just not declaring any class struct,
allowing us to remove the class_size field from the TypeInfo
variables for those types.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200916182519.415636-3-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include/qom')
-rw-r--r-- | include/qom/object.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/qom/object.h b/include/qom/object.h index 405a2c67b0..d5814bd11d 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -639,19 +639,19 @@ struct Object * @InstanceType: instance struct name * @module_obj_name: the object name in lowercase with underscore separators * @MODULE_OBJ_NAME: the object name in uppercase with underscore separators - * @ParentClassType: class struct name of parent type * - * This does the same as OBJECT_DECLARE_TYPE(), but also declares - * the class struct, thus only the object struct needs to be declare - * manually. + * This does the same as OBJECT_DECLARE_TYPE(), but with no class struct + * declared. * * This macro should be used unless the class struct needs to have * virtual methods declared. */ -#define OBJECT_DECLARE_SIMPLE_TYPE(InstanceType, module_obj_name, \ - MODULE_OBJ_NAME, ParentClassType) \ - OBJECT_DECLARE_TYPE(InstanceType, InstanceType##Class, module_obj_name, MODULE_OBJ_NAME) \ - struct InstanceType##Class { ParentClassType parent_class; }; +#define OBJECT_DECLARE_SIMPLE_TYPE(InstanceType, module_obj_name, MODULE_OBJ_NAME) \ + typedef struct InstanceType InstanceType; \ + \ + G_DEFINE_AUTOPTR_CLEANUP_FUNC(InstanceType, object_unref) \ + \ + DECLARE_INSTANCE_CHECKER(InstanceType, MODULE_OBJ_NAME, TYPE_##MODULE_OBJ_NAME) /** |