From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWruf-0008GR-8c for qemu-devel@nongnu.org; Mon, 29 Apr 2013 13:30:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWrud-0005ib-Gj for qemu-devel@nongnu.org; Mon, 29 Apr 2013 13:30:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57211 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWrud-0005iX-99 for qemu-devel@nongnu.org; Mon, 29 Apr 2013 13:30:51 -0400 Message-ID: <517EAE4A.90108@suse.de> Date: Mon, 29 Apr 2013 19:30:50 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1366303444-24620-1-git-send-email-pbonzini@redhat.com> <1366303444-24620-7-git-send-email-pbonzini@redhat.com> In-Reply-To: <1366303444-24620-7-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 6/8] qom: do not return root for empty path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: av1474@comtv.ru, qemu-devel@nongnu.org, Anthony Liguori Am 18.04.2013 18:44, schrieb Paolo Bonzini: > An empty path will return the sole object of that type in the > QOM tree. This is different from "/", which returns the root. >=20 > Signed-off-by: Paolo Bonzini Looks OK to me, but not confident about callers' expectations. Might this need a documentation update? CC'ing Mr. QOM. Andreas > --- > qom/object.c | 12 ++---------- > 1 file changed, 2 insertions(+), 10 deletions(-) >=20 > diff --git a/qom/object.c b/qom/object.c > index 093502e..dd53d24 100644 > --- a/qom/object.c > +++ b/qom/object.c > @@ -1113,21 +1113,13 @@ static Object *object_resolve_partial_path(Obje= ct *parent, > Object *object_resolve_path_type(const char *path, const char *typenam= e, > bool *ambiguous) > { > - bool partial_path =3D true; > Object *obj; > gchar **parts; > =20 > parts =3D g_strsplit(path, "/", 0); > - if (parts =3D=3D NULL || parts[0] =3D=3D NULL) { > - g_strfreev(parts); > - return object_get_root(); > - } > - > - if (strcmp(parts[0], "") =3D=3D 0) { > - partial_path =3D false; > - } > + assert(parts); > =20 > - if (partial_path) { > + if (parts[0] =3D=3D NULL || strcmp(parts[0], "") !=3D 0) { > if (ambiguous) { > *ambiguous =3D false; > } >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg