]> git.proxmox.com Git - qemu.git/commitdiff
Make qemu_opts_parse() handle empty strings
authorMark McLoughlin <markmc@redhat.com>
Tue, 6 Oct 2009 11:17:02 +0000 (12:17 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 6 Oct 2009 19:36:11 +0000 (14:36 -0500)
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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-option.c

index 293f94cf078239022bd01d3ea7c6ff2f95909442..735259f19de97aad7dd27ea181107764b7d941b7 100644 (file)
@@ -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;
 }