qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/5] qom: allow creating an alias of a child<> p


From: Andreas Färber
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Am 17.06.2014 15:28, schrieb Peter Crosthwaite:
> On Thu, Jun 12, 2014 at 2:49 AM, Paolo Bonzini <address@hidden> 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 <address@hidden>
> 
> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]