qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Masahiro Yamada <masahiroy@kernel.org>,
	qemu-devel@nongnu.org,
	"Daniel P . Berrange" <berrange@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [PATCH] qom/object: factor out the initialization of hash table of properties
Date: Thu, 21 May 2020 16:44:52 +0200	[thread overview]
Message-ID: <3d70df37-106c-ddfc-d642-18c39ee754d3@redhat.com> (raw)
In-Reply-To: <20200512172615.2291999-1-masahiroy@kernel.org>

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



      reply	other threads:[~2020-05-21 14:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d70df37-106c-ddfc-d642-18c39ee754d3@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=masahiroy@kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).