From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MWtW3-0001oa-3s for qemu-devel@nongnu.org; Fri, 31 Jul 2009 10:55:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MWtVy-0001lr-GX for qemu-devel@nongnu.org; Fri, 31 Jul 2009 10:55:26 -0400 Received: from [199.232.76.173] (port=33716 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MWtVy-0001lk-Cv for qemu-devel@nongnu.org; Fri, 31 Jul 2009 10:55:22 -0400 Received: from mx2.redhat.com ([66.187.237.31]:33197) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MWtVx-0000xC-OT for qemu-devel@nongnu.org; Fri, 31 Jul 2009 10:55:22 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6VEt9T5010292 for ; Fri, 31 Jul 2009 10:55:09 -0400 Date: Fri, 31 Jul 2009 11:54:57 -0300 From: Luiz Capitulino Subject: Re: [Qemu-devel] [PATCH 01/10] QemuOpts: add some functions Message-ID: <20090731115457.518d4a63@doriath> In-Reply-To: <1249035941-4562-2-git-send-email-kraxel@redhat.com> References: <1249035941-4562-1-git-send-email-kraxel@redhat.com> <1249035941-4562-2-git-send-email-kraxel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On Fri, 31 Jul 2009 12:25:32 +0200 Gerd Hoffmann wrote: > qemu_opt_foreach: loop over all QemuOpts entries. > qemu_opts_id: return QemuOpts id. > > Signed-off-by: Gerd Hoffmann > --- > 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?