@@ -36,7 +36,8 @@ def generate_command_decl(name, args, ret_type):
return mcgen('''
%(ret_type)s qmp_%(name)s(%(args)sError **errp);
''',
- ret_type=c_type(ret_type), name=c_fun(name), args=arglist).strip()
+ ret_type=c_type(ret_type), name=c_var(name),
+ args=arglist).strip()
def gen_err_check(errvar):
if errvar:
@@ -62,7 +63,7 @@ def gen_sync_call(name, args, ret_type, indent=0):
%(retval)sqmp_%(name)s(%(args)s&local_err);
''',
- name=c_fun(name), args=arglist, retval=retval).rstrip()
+ name=c_var(name), args=arglist, retval=retval).rstrip()
if ret_type:
ret += "\n" + gen_err_check('local_err')
ret += "\n" + mcgen(''''
@@ -76,7 +77,7 @@ def gen_sync_call(name, args, ret_type, indent=0):
def gen_marshal_output_call(name, ret_type):
if not ret_type:
return ""
- return "qmp_marshal_output_%s(retval, ret, &local_err);" % c_fun(name)
+ return "qmp_marshal_output_%s(retval, ret, &local_err);" % c_var(name)
def gen_visitor_input_containers_decl(args, obj):
ret = ""
@@ -198,16 +199,16 @@ out:
qapi_dealloc_visitor_cleanup(md);
}
''',
- c_ret_type=c_type(ret_type), c_name=c_fun(name),
+ c_ret_type=c_type(ret_type), c_name=c_var(name),
visitor=type_visitor(ret_type))
return ret
def gen_marshal_input_decl(name, args, ret_type, middle_mode):
if middle_mode:
- return 'int qmp_marshal_input_%s(Monitor *mon, const QDict *qdict, QObject **ret)' % c_fun(name)
+ return 'int qmp_marshal_input_%s(Monitor *mon, const QDict *qdict, QObject **ret)' % c_var(name)
else:
- return 'static void qmp_marshal_input_%s(QDict *args, QObject **ret, Error **errp)' % c_fun(name)
+ return 'static void qmp_marshal_input_%s(QDict *args, QObject **ret, Error **errp)' % c_var(name)
@@ -309,7 +310,7 @@ def gen_registry(commands):
registry += mcgen('''
qmp_register_command("%(name)s", qmp_marshal_input_%(c_name)s, %(opts)s);
''',
- name=cmd['command'], c_name=c_fun(cmd['command']),
+ name=cmd['command'], c_name=c_var(cmd['command']),
opts=options)
pop_indent()
ret = mcgen('''
@@ -17,7 +17,7 @@ import getopt
import errno
def _generate_event_api_name(event_name, params):
- api_name = "void qapi_event_send_%s(" % c_fun(event_name).lower();
+ api_name = "void qapi_event_send_%s(" % c_var(event_name).lower();
l = len(api_name)
if params:
@@ -184,7 +184,7 @@ const int %(name)s_qtypes[QTYPE_MAX] = {
''',
qtype = qtype,
abbrev = de_camel_case(name).upper(),
- enum = c_fun(de_camel_case(key),False).upper())
+ enum = c_var(de_camel_case(key),False).upper())
ret += mcgen('''
};
@@ -221,7 +221,7 @@ struct %(name)s
%(c_type)s %(c_name)s;
''',
c_type=c_type(typeinfo[key]),
- c_name=c_fun(key))
+ c_name=c_var(key))
ret += mcgen('''
};
@@ -247,7 +247,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **e
''',
enum_full_value = enum_full_value,
c_type = type_name(members[key]),
- c_name = c_fun(key))
+ c_name = c_var(key))
ret += mcgen('''
default:
@@ -348,7 +348,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **e
''',
enum_full_value = enum_full_value,
c_type=type_name(members[key]),
- c_name=c_fun(key))
+ c_name=c_var(key))
ret += mcgen('''
default:
@@ -781,9 +781,6 @@ def c_var(name, protect=True):
return "q_" + name
return name.translate(c_var_trans)
-def c_fun(name, protect=True):
- return c_var(name, protect)
-
def c_list_type(name):
return '%sList' % name
@@ -940,7 +937,7 @@ def guardend(name):
# ENUM_NAME -> ENUM_NAME, ENUM_NAME1 -> ENUM_NAME1, ENUM_Name2 -> ENUM_NAME2
# ENUM24_Name -> ENUM24_NAME
def _generate_enum_string(value):
- c_fun_str = c_fun(value, False)
+ c_fun_str = c_var(value, False)
if value.isupper():
return c_fun_str
Now that the two functions are identical, we only need one of them. Signed-off-by: Eric Blake <eblake@redhat.com> --- scripts/qapi-commands.py | 15 ++++++++------- scripts/qapi-event.py | 2 +- scripts/qapi-types.py | 4 ++-- scripts/qapi-visit.py | 4 ++-- scripts/qapi.py | 5 +---- 5 files changed, 14 insertions(+), 16 deletions(-)