From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoIYM-000643-Qx for qemu-devel@nongnu.org; Mon, 19 Oct 2015 18:05:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoIYH-0005Ga-So for qemu-devel@nongnu.org; Mon, 19 Oct 2015 18:05:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoIYH-0005GU-Lf for qemu-devel@nongnu.org; Mon, 19 Oct 2015 18:05:09 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 19FB72DC42A for ; Mon, 19 Oct 2015 22:05:09 +0000 (UTC) References: <1444648509-29179-1-git-send-email-berrange@redhat.com> <1444648509-29179-3-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <5625690F.2090407@redhat.com> Date: Mon, 19 Oct 2015 16:05:03 -0600 MIME-Version: 1.0 In-Reply-To: <1444648509-29179-3-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LWtl2g5n1HUbQwRVroTiXghnHtpAax6FM" Subject: Re: [Qemu-devel] [PATCH v2 02/16] sockets: move qapi_copy_SocketAddress into qemu-sockets.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Paolo Bonzini , "Dr. David Alan Gilbert" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LWtl2g5n1HUbQwRVroTiXghnHtpAax6FM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/12/2015 05:14 AM, Daniel P. Berrange wrote: > The qapi_copy_SocketAddress method is going to be useful > in more places than just qemu-char.c, so move it into > the qemu-sockets.c file to allow its reuse. >=20 > Signed-off-by: Daniel P. Berrange > --- > include/qemu/sockets.h | 4 ++++ > qemu-char.c | 25 ------------------------- > util/qemu-sockets.c | 30 ++++++++++++++++++++++++++++++ > 3 files changed, 34 insertions(+), 25 deletions(-) >=20 > +++ b/qemu-char.c > @@ -92,31 +92,6 @@ > =20 > /***********************************************************/ > /* Socket address helpers */ > -static void qapi_copy_SocketAddress(SocketAddress **p_dest, > - SocketAddress *src) > -{ > - QmpOutputVisitor *qov; > - QmpInputVisitor *qiv; > - Visitor *ov, *iv; > - QObject *obj; > - > - *p_dest =3D NULL; > - > - qov =3D qmp_output_visitor_new(); > - ov =3D qmp_output_get_visitor(qov); > - visit_type_SocketAddress(ov, &src, NULL, &error_abort); > - obj =3D qmp_output_get_qobject(qov); > - qmp_output_visitor_cleanup(qov); > - if (!obj) { > - return; > - } > - > - qiv =3D qmp_input_visitor_new(obj); > - iv =3D qmp_input_get_visitor(qiv); > - visit_type_SocketAddress(iv, p_dest, NULL, &error_abort); > - qmp_input_visitor_cleanup(qiv); > - qobject_decref(obj); Interesting approach - it means that this copy will work no matter what further extensions we add into the qapi type. But rather heavyweight compared to just doing a memberwise copy, no? At any rate, this commit is straight code motion, so you did it correctly, but we may want to simplify things in a later commit. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --LWtl2g5n1HUbQwRVroTiXghnHtpAax6FM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWJWkPAAoJEKeha0olJ0NqwXEH/igkRrRg4Wza7sxMQeYSfR+K B6XFNKznjnShXoc4hX9NVcw9iIfe3ykh9xbbr5QiKmYjGHi4yyzzFeboGSa8+E2s xkOFXQo+2lDWLaSNdM3GBfsTh62DsglRKSY68tho7byYlv+ODypt1vjKXpQ0tzNO OMaeYZ5KqCxlvWqsX42Vra/DXD7GnPXhmf7cjEqrKG1ObvUA+o+OMH3liwclpprr S0ERT3FhT52gP3BsxBO0lPgYkj0nmKNko69+4lDKzYQDFISidtRaOddLJ4eKfGHP S214ZRurgLapJT/kv2jXsDEZpc0++qyyPgJv1mm+cKe/GXKKxQ1uitdOtfRqh74= =vUL6 -----END PGP SIGNATURE----- --LWtl2g5n1HUbQwRVroTiXghnHtpAax6FM--