Just to put the flag parsing part into a standalone function, which will
be used in follow up patches.  No functional change.

Signed-off-by: Peter Xu <pet...@redhat.com>
---
 vl.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/vl.c b/vl.c
index 16b913f9d5..25e156c020 100644
--- a/vl.c
+++ b/vl.c
@@ -2302,10 +2302,8 @@ static int fsdev_init_func(void *opaque, QemuOpts *opts, 
Error **errp)
 }
 #endif
 
-static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
+static int mon_parse_flags(QemuOpts *opts)
 {
-    Chardev *chr;
-    const char *chardev;
     const char *mode;
     int flags;
 
@@ -2330,6 +2328,16 @@ static int mon_init_func(void *opaque, QemuOpts *opts, 
Error **errp)
         flags |= MONITOR_USE_OOB;
     }
 
+    return flags;
+}
+
+static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
+{
+    Chardev *chr;
+    const char *chardev;
+    int flags;
+
+    flags = mon_parse_flags(opts);
     chardev = qemu_opt_get(opts, "chardev");
     chr = qemu_chr_find(chardev);
     if (chr == NULL) {
-- 
2.17.1


Reply via email to