aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi.py
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-09-16 13:06:20 +0200
committerMarkus Armbruster <armbru@redhat.com>2015-09-21 09:56:48 +0200
commit03b4367a556179e3e59affa535493427bd009e9d (patch)
tree067858689962c019e9a0e9d957a56b1995176a97 /scripts/qapi.py
parent7fad30f06eb6aa57aaa8f3d264288f24ae7646f0 (diff)
qapi: De-duplicate parameter list generation
Generated qapi-event.[ch] lose line breaks. No change otherwise. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1442401589-24189-18-git-send-email-armbru@redhat.com>
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r--scripts/qapi.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 7ac72f6a78..6b6f1aecdc 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1469,6 +1469,22 @@ extern const char *const %(c_name)s_lookup[];
c_name=c_name(name))
return ret
+def gen_params(arg_type, extra):
+ if not arg_type:
+ return extra
+ assert not arg_type.variants
+ ret = ''
+ sep = ''
+ for memb in arg_type.members:
+ ret += sep
+ sep = ', '
+ if memb.optional:
+ ret += 'bool has_%s, ' % c_name(memb.name)
+ ret += '%s %s' % (memb.type.c_type(is_param=True), c_name(memb.name))
+ if extra:
+ ret += sep + extra
+ return ret
+
#
# Common command line parsing
#