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.
> 
> Signed-off-by: Dong Xu Wang <wdon...@linux.vnet.ibm.com>
> Signed-off-by: Chunyan Liu <cy...@suse.com>
> ---
>  include/qemu/option.h |  1 +
>  util/qemu-option.c    | 11 +++++++++++
>  2 files changed, 12 insertions(+)
> 

> +void qemu_opts_print_help(QemuOptsList *list)
> +{
> +    int i;
> +
> +    printf("Supported options:\n");
> +    for (i = 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 = 0; list->desc[i].name; i++) { ...

or even

QemuOptDesc *desc;
assert(list);
desc = list->desc;
while (desc->name) {
    ...
    desc++;
}

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to