From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSYCQ-0001xL-EP for qemu-devel@nongnu.org; Tue, 25 Mar 2014 16:43:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSYCL-0007d6-2w for qemu-devel@nongnu.org; Tue, 25 Mar 2014 16:43:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSYCK-0007cx-Pw for qemu-devel@nongnu.org; Tue, 25 Mar 2014 16:43:49 -0400 Message-ID: <5331EA82.1000305@redhat.com> Date: Tue, 25 Mar 2014 14:43:46 -0600 From: Eric Blake MIME-Version: 1.0 References: <1395396763-26081-1-git-send-email-cyliu@suse.com> <1395396763-26081-8-git-send-email-cyliu@suse.com> In-Reply-To: <1395396763-26081-8-git-send-email-cyliu@suse.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nwINVbuiMs6nbvMUjM2FjlpUT5rpsErxE" Subject: Re: [Qemu-devel] [PATCH v23 07/32] add qemu_opts_print_help to replace print_option_help List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chunyan Liu , qemu-devel@nongnu.org Cc: stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --nwINVbuiMs6nbvMUjM2FjlpUT5rpsErxE Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/21/2014 04:12 AM, Chunyan Liu wrote: > print_option_help takes QEMUOptionParameter as parameter, add > qemu_opts_print_help to take QemuOptsList as parameter for later > replace work. >=20 > Signed-off-by: Dong Xu Wang > Signed-off-by: Chunyan Liu > --- > include/qemu/option.h | 1 + > util/qemu-option.c | 11 +++++++++++ > 2 files changed, 12 insertions(+) >=20 > +void qemu_opts_print_help(QemuOptsList *list) > +{ > + int i; > + > + printf("Supported options:\n"); > + for (i =3D 0; list && list->desc[i].name; i++) { Similar to print_option_help(), this prints "Supported options:\n" on a line by itself if list is NULL. But do any of the drivers/protocols actually lack options? Is it worth guaranteeing that this is only used on non-empty lists? What would happen if you wrote this as: assert(list); for (i =3D 0; list->desc[i].name; i++) { ... or even QemuOptDesc *desc; assert(list); desc =3D list->desc; while (desc->name) { ... desc++; } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --nwINVbuiMs6nbvMUjM2FjlpUT5rpsErxE 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/ iQEcBAEBCAAGBQJTMeqCAAoJEKeha0olJ0NqNykH/0QRW2j07fVDZCqSXP0Cnf2w 0OgYGZfxZZ42qXR3QKtdZfTft9BS0QbtOxmRsYfk1J5ELx1MCrnwpP/lqVsqZgbu whu+1nROnOnlnBLKDLN/molDGRPd1bciVKw8jct0NV2HmhRVDJOe5WZrOFrjFn/4 2Y6YXkvT/85T4sLoxxLedVI7937EUJVP/16usEQQw+xrRscjybQKhI/ro/03Y+Hv Nl2OE57Ub611m7WZPSOELK3ZMwp77s8jhvpeMWvbQ+pfYAGpz0KjJD4xKAEbf75Z M9Xsw5xynzK7b7ECjns1PuL2KpgfLQPkjxHTpjsxTrkNJCtZjpmig4TYIikgFrQ= =Lm/8 -----END PGP SIGNATURE----- --nwINVbuiMs6nbvMUjM2FjlpUT5rpsErxE--