qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 01/10] QemuOpts: add some functions


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH 01/10] QemuOpts: add some functions
Date: Fri, 31 Jul 2009 11:54:57 -0300

On Fri, 31 Jul 2009 12:25:32 +0200
Gerd Hoffmann <address@hidden> wrote:

> qemu_opt_foreach: loop over all QemuOpts entries.
> qemu_opts_id: return QemuOpts id.
> 
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
>  qemu-option.c |   19 +++++++++++++++++++
>  qemu-option.h |    4 ++++
>  2 files changed, 23 insertions(+), 0 deletions(-)
> 
> diff --git a/qemu-option.c b/qemu-option.c
> index 591d178..7164ee8 100644
> --- a/qemu-option.c
> +++ b/qemu-option.c
> @@ -607,6 +607,20 @@ int qemu_opt_set(QemuOpts *opts, const char *name, const 
> char *value)
>      return 0;
>  }
>  
> +int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
> +                     int abort_on_failure)
> +{
> +    QemuOpt *opt;
> +    int rc = 0;
> +
> +    TAILQ_FOREACH(opt, &opts->head, next) {
> +        rc = func(opt->name, opt->str, opaque);
> +        if (abort_on_failure  &&  rc != 0)
> +            break;
> +    }
> +    return rc;
> +}
> +
>  QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id)
>  {
>      QemuOpts *opts;
> @@ -663,6 +677,11 @@ int qemu_opts_set(QemuOptsList *list, const char *id,
>      return qemu_opt_set(opts, name, value);
>  }
>  
> +const char *qemu_opts_id(QemuOpts *opts)
> +{
> +    return opts->id;
> +}
> +

 Can't you constify *opts in those functions?




reply via email to

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