From patchwork Wed Sep 23 10:24:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [10/24] Make qemu_opts_parse() handle empty strings Date: Wed, 23 Sep 2009 00:24:09 -0000 From: Mark McLoughlin X-Patchwork-Id: 34131 Message-Id: <1253701463-3134-11-git-send-email-markmc@redhat.com> To: qemu-devel@nongnu.org Cc: Mark McLoughlin 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 --- qemu-option.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/qemu-option.c b/qemu-option.c index 246f211..390444f 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; }