From patchwork Thu Jun 5 09:20:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 356302 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A9C9D140080 for ; Thu, 5 Jun 2014 20:55:08 +1000 (EST) Received: from localhost ([::1]:39409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsTva-0000e4-DQ for incoming@patchwork.ozlabs.org; Thu, 05 Jun 2014 05:25:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsTrk-00039o-Vg for qemu-devel@nongnu.org; Thu, 05 Jun 2014 05:21:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsTrd-00087W-5z for qemu-devel@nongnu.org; Thu, 05 Jun 2014 05:21:44 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:47084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsTrc-00086Z-UO for qemu-devel@nongnu.org; Thu, 05 Jun 2014 05:21:37 -0400 Received: from linux-cyliu.lab.bej.apac.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by victor.provo.novell.com with ESMTP (NOT encrypted); Thu, 05 Jun 2014 03:21:21 -0600 From: Chunyan Liu To: qemu-devel@nongnu.org Date: Thu, 5 Jun 2014 17:20:40 +0800 Message-Id: <1401960072-2363-2-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1401960072-2363-1-git-send-email-cyliu@suse.com> References: <1401960072-2363-1-git-send-email-cyliu@suse.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.250.26 Cc: stefanha@redhat.com Subject: [Qemu-devel] [PATCH v28 01/33] QemuOpts: move find_desc_by_name ahead for later calling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Blake Signed-off-by: Chunyan Liu --- util/qemu-option.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/util/qemu-option.c b/util/qemu-option.c index 324e4c5..c188c5c 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -173,6 +173,20 @@ static void parse_option_number(const char *name, const char *value, } } +static const QemuOptDesc *find_desc_by_name(const QemuOptDesc *desc, + const char *name) +{ + int i; + + for (i = 0; desc[i].name != NULL; i++) { + if (strcmp(desc[i].name, name) == 0) { + return &desc[i]; + } + } + + return NULL; +} + void parse_option_size(const char *name, const char *value, uint64_t *ret, Error **errp) { @@ -637,20 +651,6 @@ static bool opts_accepts_any(const QemuOpts *opts) return opts->list->desc[0].name == NULL; } -static const QemuOptDesc *find_desc_by_name(const QemuOptDesc *desc, - const char *name) -{ - int i; - - for (i = 0; desc[i].name != NULL; i++) { - if (strcmp(desc[i].name, name) == 0) { - return &desc[i]; - } - } - - return NULL; -} - int qemu_opt_unset(QemuOpts *opts, const char *name) { QemuOpt *opt = qemu_opt_find(opts, name);