aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-08-15 21:37:36 +0800
committerMarkus Armbruster <armbru@redhat.com>2018-08-28 18:21:38 +0200
commitbdd2d42b890b3a908fa3fbdc9661541e1b57eb15 (patch)
tree1916fceef08db7c32f0019388b847adb2a58cfe7 /scripts/qapi
parent19b599f7664b2ebfd0f405fb79c14dd241557452 (diff)
qapi: Fix build_params() for empty parameter list
build_params() returns '' instead of 'void' when there are no parameters. Can't happen now, but the next commit will change that. Signed-off-by: Markus Armbruster <armbru@redhat.com> [peterx: compose the patch from email replies] Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180815133747.25032-3-peterx@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r--scripts/qapi/common.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index 02c5c6767a..3b0d4bf9c0 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -2070,16 +2070,14 @@ extern const QEnumLookup %(c_name)s_lookup;
return ret
-def build_params(arg_type, boxed, extra):
- if not arg_type:
- assert not boxed
- return extra
+def build_params(arg_type, boxed, extra=None):
ret = ''
sep = ''
if boxed:
+ assert arg_type
ret += '%s arg' % arg_type.c_param_type()
sep = ', '
- else:
+ elif arg_type:
assert not arg_type.variants
for memb in arg_type.members:
ret += sep
@@ -2090,7 +2088,7 @@ def build_params(arg_type, boxed, extra):
c_name(memb.name))
if extra:
ret += sep + extra
- return ret
+ return ret if ret else 'void'
#