From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIMSZ-0003qQ-6D for qemu-devel@nongnu.org; Thu, 23 Jul 2015 15:47:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIMST-00077m-Qv for qemu-devel@nongnu.org; Thu, 23 Jul 2015 15:47:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55778) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIMST-00077b-KR for qemu-devel@nongnu.org; Thu, 23 Jul 2015 15:47:09 -0400 References: <1435782155-31412-1-git-send-email-armbru@redhat.com> <1435782155-31412-39-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55B144B7.5030204@redhat.com> Date: Thu, 23 Jul 2015 13:47:03 -0600 MIME-Version: 1.0 In-Reply-To: <1435782155-31412-39-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7mRpV6kaUmu7l9Ebh1aVJwPS0NOoUFOa6" Subject: Re: [Qemu-devel] [PATCH RFC v2 38/47] qapi-commands: De-duplicate output marshaling functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --7mRpV6kaUmu7l9Ebh1aVJwPS0NOoUFOa6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/01/2015 02:22 PM, Markus Armbruster wrote: > gen_marshal_output() uses its parameter name only for name of the > generated function. Name it after the type being marshaled instead of > its caller, and drop duplicates. >=20 > Saves 7 copies of qmp_marshal_output_int() in qemu-ga, and one copy of > qmp_marshal_output_str() in qemu-system-*. qga/qapi-generated/qga-qmp-marshal.c | 227 +++++------------------------------ qmp-marshal.c | 225 +++++++++++++++------------------- 2 files changed, 134 insertions(+), 318 deletions(-) Most changes look like: -static void qmp_marshal_output_add_fd(AddfdInfo *ret_in, QObject **ret_out, Error **errp) +static void qmp_marshal_output_AddfdInfo(AddfdInfo *ret_in, QObject **ret_out, Error **errp) { Error *local_err =3D NULL; QmpOutputVisitor *mo =3D qmp_output_visitor_new(); @@ -88,7 +88,7 @@ void qmp_marshal_add_fd(QDict *args, QOb goto out; } - qmp_marshal_output_add_fd(retval, ret, &local_err); + qmp_marshal_output_AddfdInfo(retval, ret, &local_err); coupled with wholesale deletions of functions that previously had identical bodies. Nice. [I suspect there might be ways to trim a LOT more code size, by rewriting a generic marshaller helper that is passed a varargs or array-of-struct list of operations to perform in order to visit an arbitrary object, then having each command's marshaller generated with the appropriate list of arguments for the generic helpers rather than the current approach of calling out to one marshaller helper per type - but exploring ideas like that is work for another series] >=20 > Signed-off-by: Markus Armbruster > --- > scripts/qapi-commands.py | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --7mRpV6kaUmu7l9Ebh1aVJwPS0NOoUFOa6 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/ iQEcBAEBCAAGBQJVsUS3AAoJEKeha0olJ0Nqv1QH/0+WX083szdyPO807eqQxTV7 Dw6kkBrWrmusus9YJ+c1ufVN7rkIYkyqqDEwwudQacc5JmXWZTBhK0JW5UmZe2p3 uONcSiCatYFkLI7mxwUqNtflobiYcRhEicqXEI/DESfrtnxo2l0IN0geG3Ae+Jxr dPogdo8NXTHV38SqHBVC9TuIEM7GxdJ5z2KWoHfMaPNq7Kh8CmlpzyOHGkwi7vW/ Cx7yfNjhdZnbnrzqx8HjsRGsBsuYqW+ISox8xS5om4IHos7wgLoJifDMBZTQsGOJ oW9JqWmZbVtNGxKM0jra2adw4BFIgdK0HPXYTs5NjJuQ3iWza2GW50r9QD7eFyE= =lLWS -----END PGP SIGNATURE----- --7mRpV6kaUmu7l9Ebh1aVJwPS0NOoUFOa6--