Skip to content

Commit

Permalink
qom: Do not register interface "types" in the type table
Browse files Browse the repository at this point in the history
There should be no need to look them up nor enumerate the interface
"types", whose "classes" are really just vtables.  Just create the
types and add them to the interface list of the parent type.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
bonzini authored and afaerber committed Dec 19, 2013
1 parent 7fb2536 commit 7f00136
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions qom/object.c
Expand Up @@ -88,7 +88,7 @@ static TypeImpl *type_table_lookup(const char *name)
return g_hash_table_lookup(type_table_get(), name);
}

static TypeImpl *type_register_internal(const TypeInfo *info)
static TypeImpl *type_new(const TypeInfo *info)
{
TypeImpl *ti = g_malloc0(sizeof(*ti));
int i;
Expand Down Expand Up @@ -122,8 +122,15 @@ static TypeImpl *type_register_internal(const TypeInfo *info)
}
ti->num_interfaces = i;

type_table_add(ti);
return ti;
}

static TypeImpl *type_register_internal(const TypeInfo *info)
{
TypeImpl *ti;
ti = type_new(info);

type_table_add(ti);
return ti;
}

Expand Down Expand Up @@ -216,7 +223,7 @@ static void type_initialize_interface(TypeImpl *ti, const char *parent)
info.name = g_strdup_printf("%s::%s", ti->name, info.parent);
info.abstract = true;

iface_impl = type_register(&info);
iface_impl = type_new(&info);
type_initialize(iface_impl);
g_free((char *)info.name);

Expand Down

0 comments on commit 7f00136

Please sign in to comment.