qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v23 07/32] add qemu_opts_print_help to replace p


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v23 07/32] add qemu_opts_print_help to replace print_option_help
Date: Tue, 25 Mar 2014 14:43:46 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

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 <address@hidden>
> Signed-off-by: Chunyan Liu <address@hidden>
> ---
>  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

[Prev in Thread] Current Thread [Next in Thread]