From patchwork Thu Nov 1 09:12:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Wang X-Patchwork-Id: 196102 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 E40242C00C8 for ; Thu, 1 Nov 2012 20:28:55 +1100 (EST) Received: from localhost ([::1]:49238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTqq9-0007yZ-V6 for incoming@patchwork.ozlabs.org; Thu, 01 Nov 2012 05:13:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTqpj-0007Uv-Ny for qemu-devel@nongnu.org; Thu, 01 Nov 2012 05:13:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTqph-0000Z3-F1 for qemu-devel@nongnu.org; Thu, 01 Nov 2012 05:13:03 -0400 Received: from mail-da0-f45.google.com ([209.85.210.45]:33815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTqpg-0000Y0-5J for qemu-devel@nongnu.org; Thu, 01 Nov 2012 05:13:01 -0400 Received: by mail-da0-f45.google.com with SMTP id n15so1040424dad.4 for ; Thu, 01 Nov 2012 02:12:54 -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=k64WDCb++haX7ZdlmVtwmqq+LNXizl7Vbu6x4w5ahHo=; b=AQM6xemTAOFbJSOq9L+Pe3xV0ihn+OBnHaPb//yTBR7ExUWujly6hpkbQaAPOfevHw G3qAR2UmrMpmBs1y3lf+htq63KJ7q3U32lOlNgwivYnMRDCVR0JEW0Zhnk5pY5OW5LiE 9ED07pJYRuU4SPPnqBM8OrVoFoPCH04+gd3Ctcp82vPvWcjvmyyAWl5VQ2MpM9eprOKD iRkLnXAkKVWP9UqbnCrhMHQXnO2XqgKP1HJSc0LwP+AdgJazLs7SjVjpAkUAqxD7Rqw3 irLKacshkMOxNJN7EMnmHk8BytxrQMXLyr4+3pAxC/ByCh4lvQ5pZuNFh3o/nn7ibxcw w+Ow== Received: by 10.66.72.136 with SMTP id d8mr62321488pav.4.1351761174623; Thu, 01 Nov 2012 02:12:54 -0700 (PDT) Received: from localhost.localdomain ([202.108.130.138]) by mx.google.com with ESMTPS id o11sm3751238pby.8.2012.11.01.02.12.52 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Nov 2012 02:12:53 -0700 (PDT) From: Dong Xu Wang To: qemu-devel@nongnu.org Date: Thu, 1 Nov 2012 17:12:24 +0800 Message-Id: <1351761150-20705-5-git-send-email-wdongxu@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1351761150-20705-1-git-send-email-wdongxu@linux.vnet.ibm.com> References: <1351761150-20705-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.210.45 Cc: kwolf@redhat.com, Dong Xu Wang Subject: [Qemu-devel] [PATCH V5 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 --- v4->v5: 1) Rewrite qemu_opts_create_nofail. 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,