From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WATl0-0000o0-Ao for qemu-devel@nongnu.org; Mon, 03 Feb 2014 19:20:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WATkv-0001ao-FM for qemu-devel@nongnu.org; Mon, 03 Feb 2014 19:20:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WATkv-0001ak-5j for qemu-devel@nongnu.org; Mon, 03 Feb 2014 19:20:49 -0500 Message-ID: <52F0325B.609@redhat.com> Date: Mon, 03 Feb 2014 17:20:43 -0700 From: Eric Blake MIME-Version: 1.0 References: <1390488396-16538-1-git-send-email-akong@redhat.com> <1390488396-16538-4-git-send-email-akong@redhat.com> In-Reply-To: <1390488396-16538-4-git-send-email-akong@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VcN1rOaqfDKCthbA81rRrBKX4aLW2kKSN" Subject: Re: [Qemu-devel] [PATCH v4 3/5] qobject: introduce qobject_get_str() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong , qemu-devel@nongnu.org Cc: qiaonuohan@cn.fujitsu.com, lcapitulino@redhat.com, mdroth@linux.vnet.ibm.com, xiawenc@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --VcN1rOaqfDKCthbA81rRrBKX4aLW2kKSN Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/23/2014 07:46 AM, Amos Kong wrote: > Signed-off-by: Amos Kong > --- > include/qapi/qmp/qstring.h | 1 + > qobject/qstring.c | 19 +++++++++++++++++++ > 2 files changed, 20 insertions(+) Is there anything you can add to the testsuite to validate that this works as expected? I'm not quite sure if check-qdict.c is the best fit, but it's the sort of test I have in mind. > +++ b/qobject/qstring.c > @@ -135,6 +135,25 @@ const char *qstring_get_str(const QString *qstring= ) > } > =20 > /** > + * qobject_to_str(): Convert a QObject to QString and return > + * a pointer to the stored string > + */ > +const char *qobject_get_str(const QObject *data) > +{ > + QString *qstr; > + > + if (!data) { > + return NULL; > + } > + qstr =3D qobject_to_qstring(data); > + if (qstr) { > + return qstring_get_str(qstr); > + } else { > + return NULL; > + } It looks like this is shorthand for getting at the string value of a QTYPE_QSTRING object. I'm not sure how you were planning on using it, or if it saves much code. This is where you could use your commit message to explain why this shorthand will be useful. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --VcN1rOaqfDKCthbA81rRrBKX4aLW2kKSN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJS8DJbAAoJEKeha0olJ0Nqew8H/33kQDQWvP6Jif3O6YhRYxWX CrS+aFu3QdifHa32wx74UZhXb/qu6xYg+B1Hoj0LFLwx51kn8RHjHWJ/3LHv84pj oubm7QvFrlHtwn5Qt6N3lUcqVr10Mkcng74aCVheU/6UccGCFBClCcLYh8etuJ/l vibUY8+UqJ0+rj3f+fZnf8dJCEa9Cc7+DMDGF3QigOpVaMEru+MGfKuu0Jb4leUO tupXv2dwYnG8j5Ay59xCgy1oTFWXCPuNp3iHWV3073Z5fRTfnUEFJUfDgIYSFS3R d92oO/7aXWWENL7GXForuWbfYgzpdomC7Fww9vmfgYgV+//+/wwcCzkUos3s9Oo= =XOZo -----END PGP SIGNATURE----- --VcN1rOaqfDKCthbA81rRrBKX4aLW2kKSN--