mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
b386becf36
commit
2cfa571f79
|
@ -712,8 +712,7 @@ int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname
|
||||||
char option[128], value[128];
|
char option[128], value[128];
|
||||||
const char *p,*pe,*pc;
|
const char *p,*pe,*pc;
|
||||||
|
|
||||||
p = params;
|
for (p = params; *p != '\0'; p++) {
|
||||||
for(;;) {
|
|
||||||
pe = strchr(p, '=');
|
pe = strchr(p, '=');
|
||||||
pc = strchr(p, ',');
|
pc = strchr(p, ',');
|
||||||
if (!pe || (pc && pc < pe)) {
|
if (!pe || (pc && pc < pe)) {
|
||||||
|
@ -750,7 +749,6 @@ int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname
|
||||||
if (*p != ',') {
|
if (*p != ',') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
p++;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue