From patchwork Wed Sep 23 10:24:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 34131 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 ozlabs.org (Postfix) with ESMTPS id 0D4F1B7B79 for ; Wed, 23 Sep 2009 20:51:00 +1000 (EST) Received: from localhost ([127.0.0.1]:57546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqPR2-00040y-9C for incoming@patchwork.ozlabs.org; Wed, 23 Sep 2009 06:50:56 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqP2r-0003nP-O7 for qemu-devel@nongnu.org; Wed, 23 Sep 2009 06:25:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqP2i-0003gk-M7 for qemu-devel@nongnu.org; Wed, 23 Sep 2009 06:25:53 -0400 Received: from [199.232.76.173] (port=37815 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqP2g-0003fo-Mq for qemu-devel@nongnu.org; Wed, 23 Sep 2009 06:25:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6475) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqP2f-0001VL-Lt for qemu-devel@nongnu.org; Wed, 23 Sep 2009 06:25:46 -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 n8NAPj9C020488 for ; Wed, 23 Sep 2009 06:25:45 -0400 Received: from blaa.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8NAPhdR019733; Wed, 23 Sep 2009 06:25:44 -0400 Received: by blaa.localdomain (Postfix, from userid 500) id 0AB794743C; Wed, 23 Sep 2009 11:24:24 +0100 (IST) From: Mark McLoughlin To: qemu-devel@nongnu.org Date: Wed, 23 Sep 2009 11:24:09 +0100 Message-Id: <1253701463-3134-11-git-send-email-markmc@redhat.com> In-Reply-To: <1253701463-3134-1-git-send-email-markmc@redhat.com> References: <1253701463-3134-1-git-send-email-markmc@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Mark McLoughlin Subject: [Qemu-devel] [PATCH 10/24] 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 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; }