From: Markus Armbruster <[email protected]> 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]> --- scripts/qapi/common.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 9230a2a3e8..6471c45233 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -2067,16 +2067,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 @@ -2087,7 +2085,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' # -- 2.17.1
