From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mv84M-0006un-SL for qemu-devel@nongnu.org; Tue, 06 Oct 2009 07:19:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mv84F-0006qd-Du for qemu-devel@nongnu.org; Tue, 06 Oct 2009 07:18:59 -0400 Received: from [199.232.76.173] (port=40405 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mv84E-0006q7-Do for qemu-devel@nongnu.org; Tue, 06 Oct 2009 07:18:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17012) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mv84D-0007sH-Dq for qemu-devel@nongnu.org; Tue, 06 Oct 2009 07:18:53 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n96BIqSR015875 for ; Tue, 6 Oct 2009 07:18:52 -0400 From: Mark McLoughlin Date: Tue, 6 Oct 2009 12:17:02 +0100 Message-Id: <1254827836-11021-13-git-send-email-markmc@redhat.com> In-Reply-To: <1254827783.2720.42.camel@blaa> References: <1254827783.2720.42.camel@blaa> Subject: [Qemu-devel] [PATCH] 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 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; } -- 1.6.2.5