From: "Andreas Färber" <afaerber@suse.de>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/5] qom: allow creating an alias of a child<> property
Date: Tue, 17 Jun 2014 18:37:11 +0200 [thread overview]
Message-ID: <53A06EB7.8020801@suse.de> (raw)
In-Reply-To: <CAEgOgz7=HDNbT5EaaDKO6HRVymnN3sU5sKqD82Qqj8shthVa9Q@mail.gmail.com>
Am 17.06.2014 15:28, schrieb Peter Crosthwaite:
> On Thu, Jun 12, 2014 at 2:49 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> diff --git a/qom/object.c b/qom/object.c
>> index e146ae5..ddf781e 100644
>> --- a/qom/object.c
>> +++ b/qom/object.c
>> @@ -1575,22 +1575,31 @@ void object_property_add_alias(Object *obj, const char *name,
>> {
>> AliasProperty *prop;
>> ObjectProperty *target_prop;
>> + gchar *prop_type;
>>
>> target_prop = object_property_find(target_obj, target_name, errp);
>> if (!target_prop) {
>> return;
>> }
>>
>> + if (object_property_is_child(target_prop)) {
>> + prop_type = g_strdup_printf("link%s", target_prop->type + 5);
>
> strlen("child") ?
+1
> Or some comment to explain the magic 5.
>
> Otherwise:
>
> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>
> Longer term, should "child" and "link" be macrofied and these
> hardcoded strlen's be fixed to avoid difficult developer traps if
> anyone ever tries to change the literal strings?
I think my preference would be a helper function that returns the T from
link<T> (non-dup'ed), which could then here be used as "link<%s>". The
issue with a constant is that elsewhere 6 would be used.
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2014-06-17 16:37 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-11 16:49 [Qemu-devel] [PATCH 0/5] qom: path resolution, property aliases and more Paolo Bonzini
2014-06-11 16:49 ` [Qemu-devel] [PATCH 1/5] qom: add a generic mechanism to resolve paths Paolo Bonzini
2014-06-17 13:08 ` Peter Crosthwaite
2014-06-17 14:18 ` Andreas Färber
2014-06-17 15:07 ` Paolo Bonzini
2014-06-17 15:19 ` Andreas Färber
2014-06-17 15:25 ` Paolo Bonzini
2014-06-17 15:15 ` Andreas Färber
2014-06-11 16:49 ` [Qemu-devel] [PATCH 2/5] qom: add object_property_add_alias() Paolo Bonzini
2014-06-17 15:42 ` Andreas Färber
2014-06-11 16:49 ` [Qemu-devel] [PATCH 3/5] qom: allow creating an alias of a child<> property Paolo Bonzini
2014-06-17 13:28 ` Peter Crosthwaite
2014-06-17 13:31 ` Paolo Bonzini
2014-06-17 13:33 ` Andreas Färber
2014-06-17 16:37 ` Andreas Färber [this message]
2014-06-17 16:46 ` Paolo Bonzini
2014-06-17 16:47 ` Andreas Färber
2014-06-11 16:49 ` [Qemu-devel] [PATCH 4/5] qom: allow creating an alias of an object Paolo Bonzini
2014-06-17 13:55 ` Peter Crosthwaite
2014-06-17 14:06 ` Paolo Bonzini
2014-06-17 14:15 ` Paolo Bonzini
2014-06-17 14:16 ` Peter Crosthwaite
2014-06-17 16:48 ` Paolo Bonzini
2014-06-11 16:49 ` [Qemu-devel] [PATCH 5/5] mc146818rtc: add "rtc" link to "/machine" Paolo Bonzini
2014-06-17 14:09 ` Peter Crosthwaite
2014-06-17 14:12 ` Paolo Bonzini
2014-06-17 14:25 ` Peter Crosthwaite
2014-06-17 15:01 ` Paolo Bonzini
2014-06-17 16:55 ` Andreas Färber
2014-06-17 17:16 ` Paolo Bonzini
2014-06-17 17:09 ` Andreas Färber
2014-06-17 17:30 ` Paolo Bonzini
2014-06-17 17:38 ` Andreas Färber
2014-06-18 7:11 ` 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=53A06EB7.8020801@suse.de \
--to=afaerber@suse.de \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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.