From b0b58195e4a3039b6a473124dc27ed707db50240 Mon Sep 17 00:00:00 2001 From: Wenchao Xia Date: Tue, 4 Mar 2014 18:44:36 -0800 Subject: qapi script: use same function to generate enum string Prior to this patch, qapi-visit.py used custom code to generate enum names used for handling a qapi union. Fix it to instead reuse common code, with identical generated results, and allowing future updates to generation to only need to touch one place. Signed-off-by: Wenchao Xia Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Signed-off-by: Luiz Capitulino --- scripts/qapi-types.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts/qapi-types.py') diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 35ad9931b6..5885bac5ba 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -144,11 +144,11 @@ typedef enum %(name)s i = 0 for value in enum_values: + enum_full_value = generate_enum_full_value(name, value) enum_decl += mcgen(''' - %(abbrev)s_%(value)s = %(i)d, + %(enum_full_value)s = %(i)d, ''', - abbrev=de_camel_case(name).upper(), - value=generate_enum_name(value), + enum_full_value = enum_full_value, i=i) i += 1 -- cgit v1.2.1