From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwV2I-0002UP-Tl for qemu-devel@nongnu.org; Mon, 16 Jun 2014 07:25:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwV2E-0001cD-0x for qemu-devel@nongnu.org; Mon, 16 Jun 2014 07:25:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53315) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwV2D-0001c9-Q3 for qemu-devel@nongnu.org; Mon, 16 Jun 2014 07:25:09 -0400 From: Stefan Hajnoczi Date: Mon, 16 Jun 2014 19:23:31 +0800 Message-Id: <1402917843-6459-8-git-send-email-stefanha@redhat.com> In-Reply-To: <1402917843-6459-1-git-send-email-stefanha@redhat.com> References: <1402917843-6459-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 07/39] QemuOpts: move find_desc_by_name ahead for later calling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Chunyan Liu , Stefan Hajnoczi From: Chunyan Liu Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Blake Signed-off-by: Chunyan Liu Signed-off-by: Stefan Hajnoczi --- 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); -- 1.9.3