From patchwork Tue Apr 29 09:08:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 343732 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D66A7140094 for ; Tue, 29 Apr 2014 19:34:20 +1000 (EST) Received: from localhost ([::1]:48262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf4Qc-0000QH-Md for incoming@patchwork.ozlabs.org; Tue, 29 Apr 2014 05:34:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf4NA-00046j-K0 for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:30:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wf4N3-0001dJ-Rl for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:30:44 -0400 Received: from [203.192.156.9] (port=7236 helo=linux-tt8j.site) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf4N3-0001cJ-Eb for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:30:37 -0400 Received: by linux-tt8j.site (Postfix, from userid 0) id 51A6983ABE; Tue, 29 Apr 2014 17:08:42 +0800 (CST) From: Chunyan Liu To: qemu-devel@nongnu.org Date: Tue, 29 Apr 2014 17:08:15 +0800 Message-Id: <1398762521-25733-7-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1398762521-25733-1-git-send-email-cyliu@suse.com> References: <1398762521-25733-1-git-send-email-cyliu@suse.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.192.156.9 Cc: stefanha@redhat.com Subject: [Qemu-devel] [PATCH V26 06/32] 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 69cdf3f..4d2d4d1 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;