From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtAvU-0005p4-W5 for qemu-devel@nongnu.org; Fri, 15 May 2015 04:25:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtAvR-0004Vc-NH for qemu-devel@nongnu.org; Fri, 15 May 2015 04:25:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtAvR-0004VJ-IV for qemu-devel@nongnu.org; Fri, 15 May 2015 04:24:57 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 41AD88E6FC for ; Fri, 15 May 2015 08:24:57 +0000 (UTC) From: Markus Armbruster Date: Fri, 15 May 2015 10:24:34 +0200 Message-Id: <1431678292-17692-9-git-send-email-armbru@redhat.com> In-Reply-To: <1431678292-17692-1-git-send-email-armbru@redhat.com> References: <1431678292-17692-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PULL 08/26] qapi: Use c_enum_const() in generate_alternate_qtypes() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 -- 1.9.3