From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVTO5-0006Pt-E4 for qemu-devel@nongnu.org; Mon, 15 Feb 2016 19:21:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVTO2-0002Ng-IK for qemu-devel@nongnu.org; Mon, 15 Feb 2016 19:21:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36259) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVTO2-0002Nc-CC for qemu-devel@nongnu.org; Mon, 15 Feb 2016 19:21:02 -0500 From: Eric Blake Date: Mon, 15 Feb 2016 17:20:47 -0700 Message-Id: <1455582057-27565-4-git-send-email-eblake@redhat.com> In-Reply-To: <1455582057-27565-1-git-send-email-eblake@redhat.com> References: <1455582057-27565-1-git-send-email-eblake@redhat.com> Subject: [Qemu-devel] [PATCH v10 03/13] qapi: Reposition error checks in gen_visit_fields() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: armbru@redhat.com, Michael Roth Change the generated code for error checking after an optional field visit to have one less level of indentation. There is no real semantic change (the compiler should be smart enough to realize that err does not change if visit_optional() returns false, and optimize out unneeded branching in that case); the main reason for the change is making the next patch (removing a pointless goto) easier to read. | if (visit_optional(v, "node-name", &has_node_name)) { | visit_type_str(v, "node-name", (char **)&node_name, &err); |- if (err) { |- goto out_obj; |- } |+ } |+ if (err) { |+ goto out_obj; | } Signed-off-by: Eric Blake --- v10: new patch --- scripts/qapi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index f97236f..fab5001 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1673,13 +1673,14 @@ def gen_visit_fields(members, prefix='', need_cast=False, skiperr=False, c_type=memb.type.c_name(), prefix=prefix, cast=cast, c_name=c_name(memb.name), name=memb.name, errp=errparg) - ret += gen_err_check(skiperr=skiperr, label=label) if memb.optional: pop_indent() ret += mcgen(''' } ''') + ret += gen_err_check(skiperr=skiperr, label=label) + return ret -- 2.5.0