From patchwork Thu Sep 10 15:18:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 33327 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id E8035B70AD for ; Fri, 11 Sep 2009 01:37:23 +1000 (EST) Received: from localhost ([127.0.0.1]:59070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mlli5-0002DT-6N for incoming@patchwork.ozlabs.org; Thu, 10 Sep 2009 11:37:21 -0400 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 Received: (qmail 2732 messnum 340964 invoked from network[83.71.108.236/83-71-108-236-dynamic.b-ras1.srl.dublin.eircom.net]); 10 Sep 2009 15:20:05 -0000 Received: from 83-71-108-236-dynamic.b-ras1.srl.dublin.eircom.net (HELO blaa.localdomain) (83.71.108.236) by mail19.svc.cra.dublin.eircom.net (qp 2732) with SMTP; 10 Sep 2009 15:20:05 -0000 Received: by blaa.localdomain (Postfix, from userid 500) id 7568F41AB1; Thu, 10 Sep 2009 16:19:01 +0100 (IST) From: Mark McLoughlin To: qemu-devel@nongnu.org Date: Thu, 10 Sep 2009 16:18:47 +0100 Message-Id: <1252595941-15196-6-git-send-email-markmc@redhat.com> X-Mailer: git-send-email 1.6.2.5 In-Reply-To: <1252595941-15196-1-git-send-email-markmc@redhat.com> References: <1252595941-15196-1-git-send-email-markmc@redhat.com> X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Mark McLoughlin Subject: [Qemu-devel] [PATCH 05/19] Make qemu_opts_parse() handle empty strings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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; }