summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi-commands.py4
-rw-r--r--scripts/qapi.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index 7d93d01..34f200a 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -29,9 +29,7 @@ def type_visitor(name):
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))
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 86e9608..dc690bb 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -470,8 +470,10 @@ def find_enum(name):
def is_enum(name):
return find_enum(name) != None
-def c_type(name):
+def c_type(name, is_param=False):
if name == 'str':
+ if is_param:
+ return 'const char *'
return 'char *'
elif name == 'int':
return 'int64_t'
OpenPOWER on IntegriCloud