qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [COMMIT 2cfa571] Make qemu_opts_parse() handle empty stri


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT 2cfa571] Make qemu_opts_parse() handle empty strings
Date: Tue, 06 Oct 2009 20:05:42 -0000

From: Mark McLoughlin <address@hidden>

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 <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>

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;
 }




reply via email to

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