From patchwork Tue Apr 29 09:10:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 343709 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 E54921400A6 for ; Tue, 29 Apr 2014 19:18:02 +1000 (EST) Received: from localhost ([::1]:48033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf4Aq-0001dU-N3 for incoming@patchwork.ozlabs.org; Tue, 29 Apr 2014 05:18:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf44s-0000Bw-Hw for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:11:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wf44l-0003Oy-GX for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:11:50 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:43472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf44l-0003OY-89 for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:11:43 -0400 Received: from linux-tt8j.lab.bej.apac.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by victor.provo.novell.com with ESMTP (NOT encrypted); Tue, 29 Apr 2014 03:11:30 -0600 From: Chunyan Liu To: qemu-devel@nongnu.org Date: Tue, 29 Apr 2014 17:10:30 +0800 Message-Id: <1398762656-26079-7-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1398762656-26079-1-git-send-email-cyliu@suse.com> References: <1398762656-26079-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 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 --- 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;