All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Barabash <alexander_barabash@mentor.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v2] Revised: Add object_property_get_child().
Date: Mon, 20 Feb 2012 17:06:08 +0200	[thread overview]
Message-ID: <4F426160.4040403@mentor.com> (raw)
In-Reply-To: <4F412E06.8020104@suse.de>

On 02/19/2012 07:14 PM, Andreas Färber wrote:
> Am 19.02.2012 17:04, schrieb Alexander Barabash:
>> ...
>>      Signed-off-by: Alexander Barabash<alexander_barabash@mentor.com>
> Please use git-send-email to submit your patches: The commit message is
> unnecessarily indented and the first line is duplicated. Instead of
> "Revised: " (which v2 already indicates) the subject should mention the
> topic, here "qom: ".
>
> http://wiki.qemu.org/Contribute/SubmitAPatch

Thanks for the advice.

>
> Your patch is doing too many things at once. Please split it up into a
> series of easily digestable and bisectable patches, e.g.:
> * ..._PREFIX/SUFFIX introduction and use in _add_child/link,
> * ..._is_child/_is_link introduction and use in
> _property_del_child/_get_canonical_path/_resolve_partial_path,
> * link_type_to_type() and use in _set_link_property,
> * REPORT_OBJECT_ERROR(),
> * object_property_get_child().

OK

>> +/* Go from LINK_PROPERTY_TYPE_PREFIX FOO LINK_PROPERTY_TYPE_SUFFIX to
>> FOO.  */
>> +static gchar *link_type_to_type(const gchar *type)
>> +{
>> +    return g_strndup(&type[sizeof(LINK_PROPERTY_TYPE_PREFIX) - 1],
>> +                     strlen(type)
>> +                     - (sizeof(LINK_PROPERTY_TYPE_PREFIX) - 1)
>> +                     - (sizeof(LINK_PROPERTY_TYPE_SUFFIX) - 1));
> Any reason not to use strlen()? I don't think this is a hot path, and
> repeated sizeof() - 1 does not read so nice. The alternative would be to
> hardcode the offsets.

I replaced "5" (i.e. the length "link<") with 
"sizeof(LINK_PROPERTY_TYPE_PREFIX) - 1".
If we assume that "strlen("link<") is always optimized away,
then certainly using strlen is equivalent and looks better.

>
> Andreas
>
Alex

  parent reply	other threads:[~2012-02-20 15:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16 17:39 [Qemu-trivial] [PATCH] Add object_property_get_child() Alexander Barabash
2012-02-16 17:39 ` [Qemu-devel] " Alexander Barabash
2012-02-16 18:16 ` [Qemu-trivial] " Peter Maydell
2012-02-16 18:16   ` Peter Maydell
2012-02-17 10:17 ` [Qemu-trivial] " Paolo Bonzini
2012-02-17 10:17   ` [Qemu-devel] " Paolo Bonzini
2012-02-19 12:36   ` Alexander Barabash
2012-02-19 16:04     ` [Qemu-devel] [PATCH v2] Revised: " Alexander Barabash
2012-02-19 17:14       ` Andreas Färber
2012-02-19 18:30         ` Peter Maydell
2012-02-20 15:06         ` Alexander Barabash [this message]
2012-02-20 11:14       ` Alexander Barabash
2012-02-20  9:11     ` [Qemu-devel] [PATCH] " Paolo Bonzini
2012-02-20 11:13       ` Alexander Barabash
2012-02-20 11:33         ` Paolo Bonzini

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=4F426160.4040403@mentor.com \
    --to=alexander_barabash@mentor.com \
    --cc=afaerber@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.