diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2020-05-13 02:26:15 +0900 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-06-10 12:09:57 -0400 |
commit | e5a0cc5e44c0344a3b8e284feeeffe43debca995 (patch) | |
tree | 99aa6fd7737db8ca2370d599740aa52d30b0cc8d /qom/object.c | |
parent | ad195c8ff562365b3e5b43e800d6acd84cb22e99 (diff) | |
download | qemu-e5a0cc5e44c0344a3b8e284feeeffe43debca995.zip qemu-e5a0cc5e44c0344a3b8e284feeeffe43debca995.tar.gz qemu-e5a0cc5e44c0344a3b8e284feeeffe43debca995.tar.bz2 |
qom/object: factor out the initialization of hash table of properties
Properties are not related to the initialization of interfaces.
The initialization of the hash table can be moved after the if-block,
and unified.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Message-Id: <20200512172615.2291999-1-masahiroy@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qom/object.c')
-rw-r--r-- | qom/object.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/qom/object.c b/qom/object.c index ea16680..a4094a6 100644 --- a/qom/object.c +++ b/qom/object.c @@ -316,8 +316,6 @@ static void type_initialize(TypeImpl *ti) g_assert(parent->instance_size <= ti->instance_size); memcpy(ti->class, parent->class, parent->class_size); ti->class->interfaces = NULL; - ti->class->properties = g_hash_table_new_full( - g_str_hash, g_str_equal, NULL, object_property_free); for (e = parent->class->interfaces; e; e = e->next) { InterfaceClass *iface = e->data; @@ -347,11 +345,11 @@ static void type_initialize(TypeImpl *ti) type_initialize_interface(ti, t, t); } - } else { - ti->class->properties = g_hash_table_new_full( - g_str_hash, g_str_equal, NULL, object_property_free); } + ti->class->properties = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, + object_property_free); + ti->class->type = ti; while (parent) { |