Make qemu_opts_parse() handle empty strings

Submitted by Mark McLoughlin on Oct. 6, 2009, 11:17 a.m.

Details

Message ID 1254827836-11021-13-git-send-email-markmc@redhat.com
State Superseded
Headers show

Commit Message

Mark McLoughlin Oct. 6, 2009, 11:17 a.m.
Rather than making callers explicitly handle empty strings by using
qemu_opts_create(), we can easily have qemu_opts_parse() handle
empty parameter strings.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 qemu-option.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/qemu-option.c b/qemu-option.c
index 293f94c..735259f 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -712,8 +712,7 @@  int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname
     char option[128], value[128];
     const char *p,*pe,*pc;
 
-    p = params;
-    for(;;) {
+    for (p = params; *p != '\0'; p++) {
         pe = strchr(p, '=');
         pc = strchr(p, ',');
         if (!pe || (pc && pc < pe)) {
@@ -750,7 +749,6 @@  int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname
         if (*p != ',') {
             break;
         }
-        p++;
     }
     return 0;
 }