def generate_command_decl(name, args, ret_type):
arglist=""
for argname, argtype, optional, structured in parse_args(args):
- argtype = c_type(argtype)
- if argtype == "char *":
- argtype = "const char *"
+ argtype = c_type(argtype, is_param=True)
if optional:
arglist += "bool has_%s, " % c_var(argname)
arglist += "%s %s, " % (argtype, c_var(argname))
bool has_%(argname)s = false;
''',
argname=c_var(argname))
- if c_type(argtype).endswith("*"):
+ if is_c_ptr(argtype):
ret += mcgen('''
%(argtype)s %(argname)s = NULL;
''',
''')
if ret_type:
- if c_type(ret_type).endswith("*"):
+ if is_c_ptr(ret_type):
retval = " %s retval = NULL;" % c_type(ret_type)
else:
retval = " %s retval;" % c_type(ret_type)