From patchwork Thu Jul 1 11:11:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v2,1/4] qemu-option: New qemu_opts_reset() Date: Thu, 01 Jul 2010 01:11:31 -0000 From: Kevin Wolf X-Patchwork-Id: 57539 Message-Id: <1277982694-28563-2-git-send-email-kwolf@redhat.com> To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Markus Armbruster Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- qemu-option.c | 9 +++++++++ qemu-option.h | 1 + 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/qemu-option.c b/qemu-option.c index 7f70d0f..30327d4 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -719,6 +719,15 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exist return opts; } +void qemu_opts_reset(QemuOptsList *list) +{ + QemuOpts *opts, *next_opts; + + QTAILQ_FOREACH_SAFE(opts, &list->head, next, next_opts) { + qemu_opts_del(opts); + } +} + int qemu_opts_set(QemuOptsList *list, const char *id, const char *name, const char *value) { diff --git a/qemu-option.h b/qemu-option.h index 4823219..9e2406c 100644 --- a/qemu-option.h +++ b/qemu-option.h @@ -115,6 +115,7 @@ int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque, QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id); QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists); +void qemu_opts_reset(QemuOptsList *list); int qemu_opts_set(QemuOptsList *list, const char *id, const char *name, const char *value); const char *qemu_opts_id(QemuOpts *opts);