From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwwNs-0004je-7J for qemu-devel@nongnu.org; Tue, 17 Jun 2014 12:37:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwwNl-0008Hg-5k for qemu-devel@nongnu.org; Tue, 17 Jun 2014 12:37:20 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36753 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwwNk-0008Hc-VX for qemu-devel@nongnu.org; Tue, 17 Jun 2014 12:37:13 -0400 Message-ID: <53A06EB7.8020801@suse.de> Date: Tue, 17 Jun 2014 18:37:11 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1402505369-12526-1-git-send-email-pbonzini@redhat.com> <1402505369-12526-4-git-send-email-pbonzini@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/5] qom: allow creating an alias of a child<> property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , Paolo Bonzini Cc: Marcelo Tosatti , "qemu-devel@nongnu.org Developers" , Stefan Hajnoczi Am 17.06.2014 15:28, schrieb Peter Crosthwaite: > On Thu, Jun 12, 2014 at 2:49 AM, Paolo Bonzini wr= ote: >> 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, co= nst char *name, >> { >> AliasProperty *prop; >> ObjectProperty *target_prop; >> + gchar *prop_type; >> >> target_prop =3D object_property_find(target_obj, target_name, err= p); >> if (!target_prop) { >> return; >> } >> >> + if (object_property_is_child(target_prop)) { >> + prop_type =3D g_strdup_printf("link%s", target_prop->type + 5= ); >=20 > strlen("child") ? +1 > Or some comment to explain the magic 5. >=20 > Otherwise: >=20 > Reviewed-by: Peter Crosthwaite >=20 > 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 (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 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg