From patchwork Thu May 8 18:52:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 347188 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 C57ED1400A3 for ; Fri, 9 May 2014 05:03:19 +1000 (EST) Received: from localhost ([::1]:48955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiTbA-0002TU-A2 for incoming@patchwork.ozlabs.org; Thu, 08 May 2014 15:03:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiTRv-0008Qw-3l for qemu-devel@nongnu.org; Thu, 08 May 2014 14:53:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiTRm-0008V3-R1 for qemu-devel@nongnu.org; Thu, 08 May 2014 14:53:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiTRm-0008Ul-Hf for qemu-devel@nongnu.org; Thu, 08 May 2014 14:53:34 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s48IrVOO006877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 May 2014 14:53:31 -0400 Received: from localhost (ovpn-113-20.phx2.redhat.com [10.3.113.20]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s48IrU0O026291; Thu, 8 May 2014 14:53:30 -0400 From: Luiz Capitulino To: peter.maydell@linaro.org Date: Thu, 8 May 2014 14:52:53 -0400 Message-Id: <1399575182-9768-30-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1399575182-9768-1-git-send-email-lcapitulino@redhat.com> References: <1399575182-9768-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws Subject: [Qemu-devel] [PULL 29/38] tests/qapi-schema: Drop superfluous error_is_set() 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 From: Markus Armbruster visit_type_TestStruct() does nothing when called with an error set. Callers shouldn't do that, and no caller does. Drop the superfluous test. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Michael Roth Signed-off-by: Luiz Capitulino --- tests/test-qmp-input-visitor.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c index 1ebafc5..a58a3e6 100644 --- a/tests/test-qmp-input-visitor.c +++ b/tests/test-qmp-input-visitor.c @@ -196,21 +196,20 @@ static void visit_type_TestStruct(Visitor *v, TestStruct **obj, const char *name, Error **errp) { Error *err = NULL; - if (!error_is_set(errp)) { - visit_start_struct(v, (void **)obj, "TestStruct", name, sizeof(TestStruct), - &err); - if (!err) { - visit_type_int(v, &(*obj)->integer, "integer", &err); - visit_type_bool(v, &(*obj)->boolean, "boolean", &err); - visit_type_str(v, &(*obj)->string, "string", &err); - - /* Always call end_struct if start_struct succeeded. */ - error_propagate(errp, err); - err = NULL; - visit_end_struct(v, &err); - } + + visit_start_struct(v, (void **)obj, "TestStruct", name, sizeof(TestStruct), + &err); + if (!err) { + visit_type_int(v, &(*obj)->integer, "integer", &err); + visit_type_bool(v, &(*obj)->boolean, "boolean", &err); + visit_type_str(v, &(*obj)->string, "string", &err); + + /* Always call end_struct if start_struct succeeded. */ error_propagate(errp, err); + err = NULL; + visit_end_struct(v, &err); } + error_propagate(errp, err); } static void test_visitor_in_struct(TestInputVisitorData *data,