qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 11/13] qemu-option: New qemu_opt_next(), qemu_opt_na


From: Markus Armbruster
Subject: [Qemu-devel] [PATCH 11/13] qemu-option: New qemu_opt_next(), qemu_opt_name()
Date: Wed, 2 Jun 2010 18:55:27 +0200

This is a more flexible alternative to qemu_opt_foreach().

Signed-off-by: Markus Armbruster <address@hidden>
---
 qemu-option.c |   13 +++++++++++++
 qemu-option.h |    4 ++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/qemu-option.c b/qemu-option.c
index 87e324c..c9f8be4 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -642,6 +642,19 @@ int qemu_opt_set(QemuOpts *opts, const char *name, const 
char *value)
     return 0;
 }
 
+QemuOpt *qemu_opt_next(QemuOpts *opts, QemuOpt *opt)
+{
+    if (!opt) {
+        return QTAILQ_FIRST(&opts->head);
+    }
+    return QTAILQ_NEXT(opt, next);
+}
+
+const char *qemu_opt_name(QemuOpt *opt)
+{
+    return opt->name;
+}
+
 int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
                      int abort_on_failure)
 {
diff --git a/qemu-option.h b/qemu-option.h
index 9e2406c..13c6a9d 100644
--- a/qemu-option.h
+++ b/qemu-option.h
@@ -109,6 +109,10 @@ int qemu_opt_get_bool(QemuOpts *opts, const char *name, 
int defval);
 uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t 
defval);
 uint64_t qemu_opt_get_size(QemuOpts *opts, const char *name, uint64_t defval);
 int qemu_opt_set(QemuOpts *opts, const char *name, const char *value);
+
+QemuOpt *qemu_opt_next(QemuOpts *opts, QemuOpt *opt);
+const char *qemu_opt_name(QemuOpt *opt);
+
 typedef int (*qemu_opt_loopfunc)(const char *name, const char *value, void 
*opaque);
 int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
                      int abort_on_failure);
-- 
1.6.6.1




reply via email to

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