From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wy0vk-0004Ho-PD for qemu-devel@nongnu.org; Fri, 20 Jun 2014 11:40:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wy0vf-0006eU-Dq for qemu-devel@nongnu.org; Fri, 20 Jun 2014 11:40:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wy0ve-0006eA-RX for qemu-devel@nongnu.org; Fri, 20 Jun 2014 11:40:39 -0400 Message-ID: <53A455EF.8050308@redhat.com> Date: Fri, 20 Jun 2014 09:40:31 -0600 From: Eric Blake MIME-Version: 1.0 References: <61b0b2f7ec170edcbe9dd45d6f098ae50c1178f9.1403243169.git.hutao@cn.fujitsu.com> In-Reply-To: <61b0b2f7ec170edcbe9dd45d6f098ae50c1178f9.1403243169.git.hutao@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="h8SmlR9TpLjvqBaKbvrCDFl60dnPE27sG" Subject: Re: [Qemu-devel] [PATCH 3/3] tests: add human format test for string output visitor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao , qemu-devel@nongnu.org Cc: Yasunori Goto , "Michael S. Tsirkin" , Paolo Bonzini This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --h8SmlR9TpLjvqBaKbvrCDFl60dnPE27sG Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/19/2014 11:55 PM, Hu Tao wrote: > Signed-off-by: Hu Tao > --- > tests/test-string-output-visitor.c | 109 +++++++++++++++++++++++++++++= +------- > 1 file changed, 90 insertions(+), 19 deletions(-) >=20 > =20 > + len =3D strlen(EnumOne_lookup[i]) + 2; > + str_human =3D g_malloc0(len); > + str_human[0] =3D '"'; > + strncpy(str_human + 1, EnumOne_lookup[i], strlen(EnumOne_looku= p[i])); > + str_human[len - 1] =3D '"'; Eww. Just use g_strdup_printf("\"%s\"", EnumOne_lookup[i]), instead of futzing around with manual length calculations. > =20 > -static void output_visitor_test_add(const char *testpath, > - TestOutputVisitorData *data, > - void (*test_func)(TestOutputVisito= rData *data, const void *user_data)) > +static void > +output_visitor_test_add(const char *testpath, Why the line split? You moved away from the usual qemu style. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --h8SmlR9TpLjvqBaKbvrCDFl60dnPE27sG 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/ iQEcBAEBCAAGBQJTpFXvAAoJEKeha0olJ0NqCQAIAJkw7ZYLX41fraO2McdPyIVD +jYhx8uYKI/KE/RBuxm8Zli7deHufgGF0RTDhvc9y4hTkFs1BPLuVUc7Now7YO28 kAEflAB6ZJA0yQn4dtpdNjEGSFLTgIOM4XIwhy4R/2HOidYhLol587GEnvIwks/P NcTr04bWQoFJqzJIvH2HWvTAcymmX9j/w94DKCVBSfOBpLzTJoGLgKGQsiLUT8mI oRrSXSjhiB2HRaAgqLorjgxpVol0UyPNu5Lh7SsKVrtItRFAOxnXIiqUAk29ww6v XcN01JpOZthP5MbnHgT92WC0hJrQvEsYP+xmW3rw++8Aznm7lCmamLltVCOJzgM= =BMlH -----END PGP SIGNATURE----- --h8SmlR9TpLjvqBaKbvrCDFl60dnPE27sG--