Skip to content

Commit

Permalink
qapi: Fix build_params() for empty parameter list
Browse files Browse the repository at this point in the history
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 <[email protected]>
[peterx: compose the patch from email replies]
Signed-off-by: Peter Xu <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
Markus Armbruster committed Aug 28, 2018
1 parent 19b599f commit bdd2d42
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions scripts/qapi/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2070,16 +2070,14 @@ def gen_enum(name, values, prefix=None):
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
Expand All @@ -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'


#
Expand Down

0 comments on commit bdd2d42

Please sign in to comment.