QAPI patches for 2017-07-12

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZZkk4AAoJEDhwtADrkYZTK7AP/1gMvj+5uFv83U5cPF5zGDtB
 I8tdw06lQioJsEuv3/n1M1yh34AgyxfVgGCGX2VT1/9DKV7KSKcXf930ihBagoMY
 p9lppZ+ElcZ5WE9mfl/bYpJefEnS8PrCa9jieSd0MW34fCKR80e1OE9u8j0lMdSZ
 KgsCy7cyV8j4Sl2MF/XkhwXhEw70p4IDL7nPSn1vJuE2pHL6HeKx/VLdKRCgvJq3
 ov9SRxAtXKAO9vcEUqzoVpcSXjh8rDtP1FkCsjQGg4xZvVi4UjK7V6hy4EWu72hk
 9Q6TZEukPW8E2D/O+P0+/PGAu1vFeTwbaOYNmpIv43r9Rb5uI4LUgBi3swBa1xH+
 GYWDbqorIjzRoNQK0Vs81daZrQJ9fZBkeFAksX8u2qvJE+mzV+m7JOnc85+N/WiT
 KLOWY5CjpeFbB+cEte7J+phNKqGArsPnnRwyhdLfvLUnpTANn+X7yh53yzgQjj54
 65dn+N60OrzCTH553OL88Rwqu5IiEXwW8DppY+Rtl8vVMWmGeLCvdCz1/oOavqe1
 hSMmGsgZD25BCCfZ2d0iH/MGc/rw+b9/wC8ekDUf8d+Ns6o5pgkG+SqjmCU4iNc2
 QIVBiAlLMFLTAWQk5JoqJvVNTXL+QtJeb5+qZ/VfAYE+Y969koX1EnNmmkGUC1TZ
 pnZx1zeul1KMERPWK1Uh
 =FPLR
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-07-12' into staging

QAPI patches for 2017-07-12

# gpg: Signature made Wed 12 Jul 2017 17:07:20 BST
# gpg:                using RSA key 0x3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2017-07-12:
  scripts: use build_ prefix for string not piped through cgen()
  qobject: Update coccinelle script to catch Q{INC, DEC}REF
  qobject: Catch another straggler for use of qdict_put_str()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-07-13 16:56:06 +01:00
commit 49bcce4b9c
6 changed files with 19 additions and 13 deletions

View File

@ -3842,7 +3842,7 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
req_json = qobject_to_json(req);
trace_handle_qmp_command(mon, qstring_get_str(req_json));
qobject_decref(QOBJECT(req_json));
QDECREF(req_json);
rsp = qmp_dispatch(cur_mon->qmp.commands, req);

View File

@ -327,7 +327,7 @@ static int img_add_key_secrets(void *opaque,
QDict *options = opaque;
if (g_str_has_suffix(name, "key-secret")) {
qdict_put(options, name, qstring_from_str(value));
qdict_put_str(options, name, value);
}
return 0;

View File

@ -3,6 +3,12 @@
expression Obj, Key, E;
@@
(
- qobject_incref(QOBJECT(E));
+ QINCREF(E);
|
- qobject_decref(QOBJECT(E));
+ QDECREF(E);
|
- qdict_put_obj(Obj, Key, QOBJECT(E));
+ qdict_put(Obj, Key, E);
|

View File

@ -21,7 +21,7 @@ def gen_command_decl(name, arg_type, boxed, ret_type):
''',
c_type=(ret_type and ret_type.c_type()) or 'void',
c_name=c_name(name),
params=gen_params(arg_type, boxed, 'Error **errp'))
params=build_params(arg_type, boxed, 'Error **errp'))
def gen_call(name, arg_type, boxed, ret_type):
@ -82,7 +82,7 @@ static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in, QObject **ret_out,
c_type=ret_type.c_type(), c_name=ret_type.c_name())
def gen_marshal_proto(name):
def build_marshal_proto(name):
return ('void qmp_marshal_%s(QDict *args, QObject **ret, Error **errp)'
% c_name(name))
@ -91,7 +91,7 @@ def gen_marshal_decl(name):
return mcgen('''
%(proto)s;
''',
proto=gen_marshal_proto(name))
proto=build_marshal_proto(name))
def gen_marshal(name, arg_type, boxed, ret_type):
@ -103,7 +103,7 @@ def gen_marshal(name, arg_type, boxed, ret_type):
{
Error *err = NULL;
''',
proto=gen_marshal_proto(name))
proto=build_marshal_proto(name))
if ret_type:
ret += mcgen('''

View File

@ -14,10 +14,10 @@
from qapi import *
def gen_event_send_proto(name, arg_type, boxed):
def build_event_send_proto(name, arg_type, boxed):
return 'void qapi_event_send_%(c_name)s(%(param)s)' % {
'c_name': c_name(name.lower()),
'param': gen_params(arg_type, boxed, 'Error **errp')}
'param': build_params(arg_type, boxed, 'Error **errp')}
def gen_event_send_decl(name, arg_type, boxed):
@ -25,10 +25,10 @@ def gen_event_send_decl(name, arg_type, boxed):
%(proto)s;
''',
proto=gen_event_send_proto(name, arg_type, boxed))
proto=build_event_send_proto(name, arg_type, boxed))
# Declare and initialize an object 'qapi' using parameters from gen_params()
# Declare and initialize an object 'qapi' using parameters from build_params()
def gen_param_var(typ):
assert not typ.variants
ret = mcgen('''
@ -42,7 +42,7 @@ def gen_param_var(typ):
if memb.optional:
ret += 'has_' + c_name(memb.name) + sep
if memb.type.name == 'str':
# Cast away const added in gen_params()
# Cast away const added in build_params()
ret += '(char *)'
ret += c_name(memb.name)
ret += mcgen('''
@ -72,7 +72,7 @@ def gen_event_send(name, arg_type, boxed):
Error *err = NULL;
QMPEventFuncEmit emit;
''',
proto=gen_event_send_proto(name, arg_type, boxed))
proto=build_event_send_proto(name, arg_type, boxed))
if arg_type and not arg_type.is_empty():
ret += mcgen('''

View File

@ -1897,7 +1897,7 @@ extern const char *const %(c_name)s_lookup[];
return ret
def gen_params(arg_type, boxed, extra):
def build_params(arg_type, boxed, extra):
if not arg_type:
assert not boxed
return extra