From patchwork Fri Nov 20 17:24:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 546973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 28E8E1402A2 for ; Sat, 21 Nov 2015 04:25:59 +1100 (AEDT) Received: from localhost ([::1]:48800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzpRc-0005Ad-QV for incoming@patchwork.ozlabs.org; Fri, 20 Nov 2015 12:25:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzpQq-00043r-K7 for qemu-devel@nongnu.org; Fri, 20 Nov 2015 12:25:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzpQo-0007nM-MR for qemu-devel@nongnu.org; Fri, 20 Nov 2015 12:25:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzpQo-0007mw-H1 for qemu-devel@nongnu.org; Fri, 20 Nov 2015 12:25:06 -0500 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 (Postfix) with ESMTPS id 2B3347C; Fri, 20 Nov 2015 17:25:06 +0000 (UTC) Received: from red.redhat.com (ovpn-113-208.phx2.redhat.com [10.3.113.208]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAKHP1Wq021481; Fri, 20 Nov 2015 12:25:05 -0500 From: Eric Blake To: qemu-devel@nongnu.org Date: Fri, 20 Nov 2015 10:24:51 -0700 Message-Id: <1448040300-968-6-git-send-email-eblake@redhat.com> In-Reply-To: <1448040300-968-1-git-send-email-eblake@redhat.com> References: <1448040300-968-1-git-send-email-eblake@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: armbru@redhat.com, Michael Roth Subject: [Qemu-devel] [PATCH v13 05/14] qapi: Inline _make_implicit_tag() 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 Now that alternates no longer use an implicit tag, we can inline _make_implicit_tag() into its one caller, _def_union_type(). No change to generated code. Suggested-by: Markus Armbruster Signed-off-by: Eric Blake --- v13: commit message touchup v12: new patch --- scripts/qapi.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index 44b6126..264de63 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1318,11 +1318,6 @@ class QAPISchema(object): typ, info, 'wrapper', [self._make_member('data', typ, info)]) return QAPISchemaObjectTypeVariant(case, typ) - def _make_implicit_tag(self, type_name, info, variants): - typ = self._make_implicit_enum_type(type_name, info, - [v.name for v in variants]) - return QAPISchemaObjectTypeMember('type', typ, False) - def _def_union_type(self, expr, info): name = expr['union'] data = expr['data'] @@ -1336,7 +1331,9 @@ class QAPISchema(object): else: variants = [self._make_simple_variant(key, value, info) for (key, value) in data.iteritems()] - tag_member = self._make_implicit_tag(name, info, variants) + typ = self._make_implicit_enum_type(name, info, + [v.name for v in variants]) + tag_member = QAPISchemaObjectTypeMember('type', typ, False) members = [tag_member] self._def_entity( QAPISchemaObjectType(name, info, base, members,