From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MllXx-0006Fx-Iy for qemu-devel@nongnu.org; Thu, 10 Sep 2009 11:26:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MllXq-0006Bj-OU for qemu-devel@nongnu.org; Thu, 10 Sep 2009 11:26:51 -0400 Received: from [199.232.76.173] (port=40170 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MllXq-0006Bc-Av for qemu-devel@nongnu.org; Thu, 10 Sep 2009 11:26:46 -0400 Received: from mail19.svc.cra.dublin.eircom.net ([159.134.118.218]:30687) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MllXp-00007F-QA for qemu-devel@nongnu.org; Thu, 10 Sep 2009 11:26:46 -0400 From: Mark McLoughlin Date: Thu, 10 Sep 2009 16:18:47 +0100 Message-Id: <1252595941-15196-6-git-send-email-markmc@redhat.com> In-Reply-To: <1252595941-15196-1-git-send-email-markmc@redhat.com> References: <1252595941-15196-1-git-send-email-markmc@redhat.com> Subject: [Qemu-devel] [PATCH 05/19] Make qemu_opts_parse() handle empty strings List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 4d544c7..d312257 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -711,8 +711,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)) { @@ -749,7 +748,6 @@ int qemu_opts_do_parse(QemuOpts *opts, const char *params, const char *firstname if (*p != ',') { break; } - p++; } return 0; } -- 1.6.2.5