aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi-types.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index 1eb272dd26..db872180c6 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -123,16 +123,19 @@ const char *%(name)s_lookup[] = {
name=name)
i = 0
for value in values:
+ index = generate_enum_full_value(name, value)
ret += mcgen('''
- "%(value)s",
+ [%(index)s] = "%(value)s",
''',
- value=value)
+ index = index, value = value)
+ max_index = generate_enum_full_value(name, 'MAX')
ret += mcgen('''
- NULL,
+ [%(max_index)s] = NULL,
};
-''')
+''',
+ max_index=max_index)
return ret
def generate_enum(name, values):