From patchwork Thu May 14 12:50:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 472345 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 E180D140284 for ; Thu, 14 May 2015 23:01:54 +1000 (AEST) Received: from localhost ([::1]:54561 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yssls-000395-SF for incoming@patchwork.ozlabs.org; Thu, 14 May 2015 09:01:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsscM-0003XO-8W for qemu-devel@nongnu.org; Thu, 14 May 2015 08:52:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsscF-00045T-Q9 for qemu-devel@nongnu.org; Thu, 14 May 2015 08:52:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35982) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsscF-00044Q-JC for qemu-devel@nongnu.org; Thu, 14 May 2015 08:51:55 -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 t4ECpBKF011210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 14 May 2015 08:51:12 -0400 Received: from red.redhat.com (ovpn-113-69.phx2.redhat.com [10.3.113.69]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4ECp5EN018641; Thu, 14 May 2015 08:51:10 -0400 From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 14 May 2015 06:50:52 -0600 Message-Id: <1431607862-9238-7-git-send-email-eblake@redhat.com> In-Reply-To: <1431607862-9238-1-git-send-email-eblake@redhat.com> References: <1431607862-9238-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: kwolf@redhat.com, akong@redhat.com, berto@igalia.com, armbru@redhat.com, mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH v4 06/16] qapi: Use c_enum_const() in generate_alternate_qtypes() 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 Missed in commit b0b5819. Signed-off-by: Markus Armbruster Signed-off-by: Eric Blake --- scripts/qapi-types.py | 6 ++---- scripts/qapi.py | 11 ----------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 6ca48c1..9eb08a6 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -180,11 +180,9 @@ const int %(name)s_qtypes[QTYPE_MAX] = { assert qtype, "Invalid alternate member" ret += mcgen(''' - [ %(qtype)s ] = %(abbrev)s_KIND_%(enum)s, + [ %(qtype)s ] = %(enum_const)s, ''', - qtype = qtype, - abbrev = de_camel_case(name).upper(), - enum = c_name(de_camel_case(key),False).upper()) + qtype = qtype, enum_const = c_enum_const(name + 'Kind', key)) ret += mcgen(''' }; diff --git a/scripts/qapi.py b/scripts/qapi.py index b917cad..3757a91 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -729,17 +729,6 @@ def parse_args(typeinfo): # value of an optional argument. yield (argname, argentry, optional) -def de_camel_case(name): - new_name = '' - for ch in name: - if ch.isupper() and new_name: - new_name += '_' - if ch == '-': - new_name += '_' - else: - new_name += ch.lower() - return new_name - def camel_case(name): new_name = '' first = True