* [PATCH] qom/object: factor out the initialization of hash table of properties
@ 2020-05-12 17:26 Masahiro Yamada
2020-05-21 14:44 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2020-05-12 17:26 UTC (permalink / raw)
To: qemu-devel, Paolo Bonzini, Daniel P . Berrange, Eduardo Habkost
Cc: Masahiro Yamada
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>
---
qom/object.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index a3ee968b12..e4085d8ae2 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) {
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] qom/object: factor out the initialization of hash table of properties
2020-05-12 17:26 [PATCH] qom/object: factor out the initialization of hash table of properties Masahiro Yamada
@ 2020-05-21 14:44 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-05-21 14:44 UTC (permalink / raw)
To: Masahiro Yamada, qemu-devel, Daniel P . Berrange, Eduardo Habkost
On 12/05/20 19:26, Masahiro Yamada wrote:
> 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>
> ---
>
> qom/object.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/qom/object.c b/qom/object.c
> index a3ee968b12..e4085d8ae2 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) {
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-21 14:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-12 17:26 [PATCH] qom/object: factor out the initialization of hash table of properties Masahiro Yamada
2020-05-21 14:44 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).