From patchwork Thu Apr 3 09:54:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 336562 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 094791400AE for ; Thu, 3 Apr 2014 20:54:39 +1100 (EST) Received: from localhost ([::1]:42970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVeM1-0002wQ-3r for incoming@patchwork.ozlabs.org; Thu, 03 Apr 2014 05:54:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVeLF-0002gf-8f for qemu-devel@nongnu.org; Thu, 03 Apr 2014 05:53:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WVeL8-0006ik-1x for qemu-devel@nongnu.org; Thu, 03 Apr 2014 05:53:49 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:37826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WVeL7-0006iV-QI for qemu-devel@nongnu.org; Thu, 03 Apr 2014 05:53:41 -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, 03 Apr 2014 03:53:30 -0600 From: Chunyan Liu To: qemu-devel@nongnu.org Date: Thu, 3 Apr 2014 17:54:23 +0800 Message-Id: <1396518889-21681-6-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1396518889-21681-1-git-send-email-cyliu@suse.com> References: <1396518889-21681-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: l@dorileo.org, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v24 05/31] QemuOpts: move qemu_opt_del 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 In later patch, qemu_opt_get_del functions will be added, they will first get the option value, then call qemu_opt_del to remove the option from opt list. To prepare for that purpose, move qemu_opt_del ahead first. Reviewed-by: Eric Blake Signed-off-by: Chunyan Liu Reviewed-by: Leandro Dorileo --- util/qemu-option.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/util/qemu-option.c b/util/qemu-option.c index eab5102..25abd65 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -567,6 +567,14 @@ static QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name) return NULL; } +static void qemu_opt_del(QemuOpt *opt) +{ + QTAILQ_REMOVE(&opt->opts->head, opt, next); + g_free(opt->name); + g_free(opt->str); + g_free(opt); +} + const char *qemu_opt_get(QemuOpts *opts, const char *name) { QemuOpt *opt = qemu_opt_find(opts, name); @@ -661,14 +669,6 @@ static void qemu_opt_parse(QemuOpt *opt, Error **errp) } } -static void qemu_opt_del(QemuOpt *opt) -{ - QTAILQ_REMOVE(&opt->opts->head, opt, next); - g_free(opt->name); - g_free(opt->str); - g_free(opt); -} - static bool opts_accepts_any(const QemuOpts *opts) { return opts->list->desc[0].name == NULL;