From patchwork Fri Nov 23 07:47:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Wang X-Patchwork-Id: 201255 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1DDE62C0086 for ; Fri, 23 Nov 2012 19:21:04 +1100 (EST) Received: from localhost ([::1]:41237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tbo18-0006fa-Cc for incoming@patchwork.ozlabs.org; Fri, 23 Nov 2012 02:49:42 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tbo02-000430-KA for qemu-devel@nongnu.org; Fri, 23 Nov 2012 02:48:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tbnzx-0001tV-SP for qemu-devel@nongnu.org; Fri, 23 Nov 2012 02:48:34 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]:33630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tbnzx-0001rA-Na for qemu-devel@nongnu.org; Fri, 23 Nov 2012 02:48:29 -0500 Received: by mail-ie0-f173.google.com with SMTP id e13so2761118iej.4 for ; Thu, 22 Nov 2012 23:48:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=KI0FuuHAhB4KGX2N95JI88y7JdWljZ382WRvr0BzWII=; b=rTYshoPsd1sSdbFvvpmsdeV0PayhLzHIaoFcALj0Pn4wVtjgeviIeemNmN0ovkVABU ua3z1CL1O/Sb3Mbxr/0AVyemVQNpGoTBgPEHRWAcKbLly2lPbHBd/P1pgAYgjz7/IgY4 hucB3QCt428SpX9gUnvBrZLIbYrfVrRhsOioZMwx689RfAoc0KOVSeoPmUUsqTt0L3zg A07jGmvG5AXP8sTiNdTEtIe1pW5RqwdyPJsT8k0m9igCKxJWqRYJyCo6EN8AtjdB24SU KUDRAoJnuRsOhakKgjd2SEEmetQyVKae3kBbNvXQMD5bsoznqUt+qa/tGR4bc9J963pD GODg== Received: by 10.50.151.166 with SMTP id ur6mr2725403igb.66.1353656909454; Thu, 22 Nov 2012 23:48:29 -0800 (PST) Received: from localhost.localdomain ([202.108.130.194]) by mx.google.com with ESMTPS id az6sm3859043igb.11.2012.11.22.23.48.26 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Nov 2012 23:48:28 -0800 (PST) From: Dong Xu Wang To: qemu-devel@nongnu.org Date: Fri, 23 Nov 2012 15:47:39 +0800 Message-Id: <1353656865-20910-5-git-send-email-wdongxu@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1353656865-20910-1-git-send-email-wdongxu@linux.vnet.ibm.com> References: <1353656865-20910-1-git-send-email-wdongxu@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.223.173 Cc: kwolf@redhat.com, Dong Xu Wang Subject: [Qemu-devel] [PATCH V6 04/10] introduce qemu_opts_create_nofail function 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 While id is NULL, qemu_opts_create can not fail, so ignore errors is fine. Signed-off-by: Dong Xu Wang --- qemu-option.c | 9 +++++++++ qemu-option.h | 1 + 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/qemu-option.c b/qemu-option.c index e0131ce..1303188 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -780,6 +780,15 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, return opts; } +QemuOpts *qemu_opts_create_nofail(QemuOptsList *list) +{ + QemuOpts *opts; + Error *errp = NULL; + opts = qemu_opts_create(list, NULL, 0, &errp); + assert_no_error(errp); + return opts; +} + void qemu_opts_reset(QemuOptsList *list) { QemuOpts *opts, *next_opts; diff --git a/qemu-option.h b/qemu-option.h index ca72986..b0f8d1e 100644 --- a/qemu-option.h +++ b/qemu-option.h @@ -133,6 +133,7 @@ int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque, QemuOpts *qemu_opts_find(QemuOptsList *list, const char *id); QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exists, Error **errp); +QemuOpts *qemu_opts_create_nofail(QemuOptsList *list); void qemu_opts_reset(QemuOptsList *list); void qemu_opts_loc_restore(QemuOpts *opts); int qemu_opts_set(QemuOptsList *list, const char *id,