From patchwork Sun Oct 14 12:51:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Wang X-Patchwork-Id: 191356 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 D4F782C008B for ; Mon, 15 Oct 2012 00:14:19 +1100 (EST) Received: from localhost ([::1]:56490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNO1J-0001fX-Sj for incoming@patchwork.ozlabs.org; Sun, 14 Oct 2012 09:14:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNNfu-00056Y-AJ for qemu-devel@nongnu.org; Sun, 14 Oct 2012 08:52:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TNNft-0003YF-0N for qemu-devel@nongnu.org; Sun, 14 Oct 2012 08:52:09 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:37310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TNNfs-0003Y1-Pv for qemu-devel@nongnu.org; Sun, 14 Oct 2012 08:52:08 -0400 Received: by mail-pa0-f45.google.com with SMTP id fb10so3999178pad.4 for ; Sun, 14 Oct 2012 05:52:06 -0700 (PDT) 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=V+OH5RJ2NM4WqvKlM6Iq2DIzQWiNiiIg/TxY9wbramQ=; b=nzYX04uGffpp+/3LC7m2WAG3bt0s2BdMlUZWNv69pINJNK/7v2yA/Fhx9F4GId5/7S RMOudILDsdLuLG4wC3SLicyjYhlkr2gXSckwDqpJQzk6KaDdnlBFy1SxE2jCx/Pnw12I HHR85RjOeYTR2EfL4dGOA5qndfV219hJreweA3EAPqKT02QJ2hUC+CivCXY/TzRZpB+w KaJIoFOhQX9R3bi5EsTCJhkGAI3Qj8d6CwcwSgAfhQvp47hD/K5NYi+Sim8LJwpjiAJL Ek7OeLt8zM7WP2dLIyyrseVmMC4lX2Dlk23ExN9uwczTseaTVPYon5XVI8c70pnVINug pwIQ== Received: by 10.66.87.132 with SMTP id ay4mr24976387pab.82.1350219126762; Sun, 14 Oct 2012 05:52:06 -0700 (PDT) Received: from localhost.localdomain ([202.108.130.138]) by mx.google.com with ESMTPS id nt7sm7447649pbb.33.2012.10.14.05.52.04 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 14 Oct 2012 05:52:05 -0700 (PDT) From: Dong Xu Wang To: qemu-devel@nongnu.org Date: Sun, 14 Oct 2012 20:51:29 +0800 Message-Id: <1350219095-3378-5-git-send-email-wdongxu@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1350219095-3378-1-git-send-email-wdongxu@linux.vnet.ibm.com> References: <1350219095-3378-1-git-send-email-wdongxu@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.220.45 Cc: kwolf@redhat.com, Dong Xu Wang Subject: [Qemu-devel] [PATCH V3 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 | 5 +++++ qemu-option.h | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/qemu-option.c b/qemu-option.c index e0131ce..d7d5ea9 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -780,6 +780,11 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, return opts; } +QemuOpts *qemu_opts_create_nofail(QemuOptsList *list) +{ + return qemu_opts_create(list, NULL, 0, NULL); +} + 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,