qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v2 1/4] vl.c: generalise qemu_get_machine_opts()


From: Peter Crosthwaite
Subject: [Qemu-devel] [PATCH v2 1/4] vl.c: generalise qemu_get_machine_opts()
Date: Thu, 17 Apr 2014 21:25:03 -0700

This "nofail" (i.e. does not return NULL) mechanism driving
qemu_get_machine_opts() does not need to be specific to machine opts
- its applicable to other types of opts. Generalise and re-implement
qemu_get_machine_opts() as a caller of the generalisation.

Signed-off-by: Peter Crosthwaite <address@hidden>
---

 vl.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/vl.c b/vl.c
index 9975e5a..bc12d0f 100644
--- a/vl.c
+++ b/vl.c
@@ -510,17 +510,12 @@ static QemuOptsList qemu_name_opts = {
     },
 };
 
-/**
- * Get machine options
- *
- * Returns: machine options (never null).
- */
-QemuOpts *qemu_get_machine_opts(void)
+static QemuOpts *qemu_get_opts_nofail(const char *type)
 {
     QemuOptsList *list;
     QemuOpts *opts;
 
-    list = qemu_find_opts("machine");
+    list = qemu_find_opts(type);
     assert(list);
     opts = qemu_opts_find(list, NULL);
     if (!opts) {
@@ -529,6 +524,17 @@ QemuOpts *qemu_get_machine_opts(void)
     return opts;
 }
 
+/**
+ * Get machine options
+ *
+ * Returns: machine options (never null).
+ */
+
+QemuOpts *qemu_get_machine_opts(void)
+{
+    return qemu_get_opts_nofail("machine");
+}
+
 const char *qemu_get_vm_name(void)
 {
     return qemu_name;
-- 
1.9.2.1.g06c4abd




reply via email to

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