Eric Blake <ebl...@redhat.com> writes:

> On 08/09/2017 10:59 AM, Markus Armbruster wrote:
>> Eric Blake <ebl...@redhat.com> writes:
>> 
>>> Leaving interpolation into JSON to qobject_from_jsonf() is more
>>> robust than building QMP input manually; however, we have a few
>>> places where code is already creating a QDict to interpolate
>>> individual arguments, which cannot be reproduced with the
>>> qobject_from_jsonf() parser.  Expose a public wrapper
>>> qmp_args_dict() for the internal helper qmp_args_dict_async()
>>> that we needed earlier for qmp_args(), and fix a test to use
>>> the new helper.
>>>
>>> Signed-off-by: Eric Blake <ebl...@redhat.com>
>>> ---
>
>>> +++ b/tests/device-introspect-test.c
>>> @@ -36,8 +36,7 @@ static QList *qom_list_types(const char *implements, bool 
>>> abstract)
>>>      if (implements) {
>>>          qdict_put_str(args, "implements", implements);
>>>      }
>>> -    resp = qmp("{'execute': 'qom-list-types',"
>>> -               " 'arguments': %p }", args);
>>> +    resp = qmp_args_dict("qom-list-types", args);
>>>      g_assert(qdict_haskey(resp, "return"));
>>>      ret = qdict_get_qlist(resp, "return");
>>>      QINCREF(ret);
>> 
>> If we had five of these, the helper would be worth its keep.
>
> This patch only  has one client, but 20/22 adds another.  Is having 2
> clients sufficient to keep it (not quite the 5 that makes it obvious,
> but still a good reuse of code)?

Your idea to use macros might make this a moot question.  Let's revisit
it in v2.

Reply via email to