summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2009-10-06 12:17:02 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-06 14:36:11 -0500
commita5d0920fe783584e8913d77f13c1e8521454bf9f (patch)
treeafb4dbebce37036c79e031216fb1f33ae6a1e25c
parentb9c77318e84e0760add74502fe95f85129af752f (diff)
downloadqemu-a5d0920fe783584e8913d77f13c1e8521454bf9f.tar.gz
qemu-a5d0920fe783584e8913d77f13c1e8521454bf9f.tar.bz2
qemu-a5d0920fe783584e8913d77f13c1e8521454bf9f.zip
Make qemu_opts_parse() handle empty strings
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>
-rw-r--r--qemu-option.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/qemu-option.c b/qemu-option.c
index 293f94cf07..735259f19d 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;
}