From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwwvV-0003TL-54 for qemu-devel@nongnu.org; Wed, 10 Jul 2013 12:07:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwwvO-0001nC-NA for qemu-devel@nongnu.org; Wed, 10 Jul 2013 12:07:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwwvO-0001mm-Fs for qemu-devel@nongnu.org; Wed, 10 Jul 2013 12:07:26 -0400 Message-ID: <51DD86B6.3000307@redhat.com> Date: Wed, 10 Jul 2013 10:07:18 -0600 From: Eric Blake MIME-Version: 1.0 References: <1371547919-15654-1-git-send-email-wdongxu@linux.vnet.ibm.com> <1371547919-15654-4-git-send-email-wdongxu@linux.vnet.ibm.com> In-Reply-To: <1371547919-15654-4-git-send-email-wdongxu@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2WDEVFUBTJBGOHXKPNOKR" Subject: Re: [Qemu-devel] [PATCH V16 3/7] Create four QemuOptsList related functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dong Xu Wang Cc: kwolf@redhat.com, wdongxu@cn.ibm.com, qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2WDEVFUBTJBGOHXKPNOKR Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/18/2013 03:31 AM, Dong Xu Wang wrote: > This patch creates 4 functions, count_opts_list, qemu_opts_append, > qemu_opts_free and qemu_opts_print_help, they are used in following > commits. >=20 >=20 >=20 > Signed-off-by: Dong Xu Wang > --- > + > +/* Create a new QemuOptsList and make its desc to the merge of first > + * and second. It will allocate space for one new QemuOptsList plus s/make its desc to the merge of/with a desc of the merge of the/ > + * enough space for QemuOptDesc in first and second QemuOptsList. > + * First argument's QemuOptDesc members take precedence over second's.= > + * The result's name and implied_opt_name are not copied from them. > + * Both merge_lists should not be set. Both list can be NULL. s/list/lists/ > + dest->name =3D "append_opts_list"; > + dest->implied_opt_name =3D NULL; > + assert((!first || !first->merge_lists) > + && (!second || !second->merge_lists)); Indentation - usually, an operator is intended to the column after the containing ( on the line above. > + > +/* free a QemuOptsList, can accept NULL as arguments */ > +void qemu_opts_free(QemuOptsList *list) > +{ > + g_free(list); > +} Do we really need a function for this, or can callers just call g_free directly? But it doesn't hurt to have the layer of indirection, especially if we might be freeing more than one thing in the future. > + > +void qemu_opts_print_help(QemuOptsList *list) > +{ > + int i; > + printf("Supported options:\n"); > + for (i =3D 0; list && list->desc[i].name; i++) { > + printf("%-16s %s\n", list->desc[i].name, > + list->desc[i].help ? Indentation - 'list' should start on the column after the containing ( on the line above. > + list->desc[i].help : "No description available"); > + } > +} >=20 None of my findings are fatal to the algorithm, so I leave it up to the maintainer whether to touch this up as part of preparing for a pull request, or whether to request a v17 respin. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2WDEVFUBTJBGOHXKPNOKR 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.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR3Ya2AAoJEKeha0olJ0NqTOUH/ilyMP0Totvm8b9LIQ8oeFH8 oc5Bp1LprRCFdIgwEXCkdbDAE1AjuL2svt8E2a+D/tuKgtsg9feDnxJhihkCLclh NVGp0L8ObgYiduQJwN/zyhOG8XiJeT3un20ZOzy5aNN9XYa6C0zzZPxMRvGHrYcb gOI+qDNzvgqXgJDlaw3kFwSXnBQBMyC31cCNRhTjJETSH5S/8nt3lyEIPWUOA6UY PZfedNErAaacLSclryF/cx1x+yMNvxKoW68Tbud6mBnhJi+tfDJYzr/xhWssFV6I I3zIOYmnYIueMctGnf4lCSz+uVHkS2hGQBwOEGmFbDqovUQguEi/weS0leGtCnQ= =kvtj -----END PGP SIGNATURE----- ------enig2WDEVFUBTJBGOHXKPNOKR--