提交 b42e9148 编写于 作者: M Markus Armbruster

qapi: Use c_enum_const() in generate_alternate_qtypes()

Missed in commit b0b58195.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 02e20c7e
......@@ -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('''
};
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册