mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
qom/object: Remove type_register()
At present, type_register() and type_register_static() are identical, although their documentation expects the *_static variant to accept the Typeinfo with the strings that have the static lifetime. However, the code implementation doesn't have any check or guarantee for static lifetime. In fact, this is unnecessary because type_new() duplicates all strings, thereby taking ownership of them. Therefore, type_register() and type_register_static() are redundant, so one of them should be removed. Since the changes required to remove type_register() were smaller, type_register() was replaced with type_register_static() throughout the code base. Drop its definition, and delete the requirement about string lifetime from the documentation. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Link: https://lore.kernel.org/r/20241029085934.2799066-17-zhao1.liu@intel.com
This commit is contained in:
parent
4e40d50558
commit
281305d3e0
2 changed files with 1 additions and 20 deletions
|
@ -175,17 +175,12 @@ static TypeImpl *type_register_internal(const TypeInfo *info)
|
|||
return ti;
|
||||
}
|
||||
|
||||
TypeImpl *type_register(const TypeInfo *info)
|
||||
TypeImpl *type_register_static(const TypeInfo *info)
|
||||
{
|
||||
assert(info->parent);
|
||||
return type_register_internal(info);
|
||||
}
|
||||
|
||||
TypeImpl *type_register_static(const TypeInfo *info)
|
||||
{
|
||||
return type_register(info);
|
||||
}
|
||||
|
||||
void type_register_static_array(const TypeInfo *infos, int nr_infos)
|
||||
{
|
||||
int i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue