mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 03:59:52 +00:00
machine: Ensure all TYPE_MACHINE subclasses have the right suffix
Now that all non-abstract TYPE_MACHINE subclasses have the -machine suffix, add an assert to ensure this will be always true. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
c0f365186b
commit
dcb3d60111
@ -316,6 +316,14 @@ static void machine_class_init(ObjectClass *oc, void *data)
|
||||
mc->default_ram_size = 128 * M_BYTE;
|
||||
}
|
||||
|
||||
static void machine_class_base_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
if (!object_class_is_abstract(oc)) {
|
||||
const char *cname = object_class_get_name(oc);
|
||||
assert(g_str_has_suffix(cname, TYPE_MACHINE_SUFFIX));
|
||||
}
|
||||
}
|
||||
|
||||
static void machine_initfn(Object *obj)
|
||||
{
|
||||
MachineState *ms = MACHINE(obj);
|
||||
@ -492,6 +500,7 @@ static const TypeInfo machine_info = {
|
||||
.abstract = true,
|
||||
.class_size = sizeof(MachineClass),
|
||||
.class_init = machine_class_init,
|
||||
.class_base_init = machine_class_base_init,
|
||||
.instance_size = sizeof(MachineState),
|
||||
.instance_init = machine_initfn,
|
||||
.instance_finalize = machine_finalize,
|
||||
|
Loading…
Reference in New Issue
Block a user