diff mbox

[05/19] Make qemu_opts_parse() handle empty strings

Message ID 1252595941-15196-6-git-send-email-markmc@redhat.com
State Superseded
Headers show

Commit Message

Mark McLoughlin Sept. 10, 2009, 3:18 p.m. UTC
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(-)
diff mbox

Patch

diff --git a/qemu-option.c b/qemu-option.c
index 4d544c7..d312257 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -711,8 +711,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)) {
@@ -749,7 +748,6 @@  int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname
         if (*p != ',') {
             break;
         }
-        p++;
     }
     return 0;
 }