@@ -80,9 +80,12 @@ static int qmp_tmp105_get_temperature(const char *id)
static void qmp_tmp105_set_temperature(const char *id, int value)
{
QDict *response;
+ QDict *args = qdict_new();
- response = qmp("{ 'execute': 'qom-set', 'arguments': { 'path': %s, "
- "'property': 'temperature', 'value': %d } }", id, value);
+ qdict_put_str(args, "path", id);
+ qdict_put_str(args, "property", "temperature");
+ qdict_put_int(args, "value", value);
+ response = qmp_cmd("qom-set", args);
g_assert(qdict_haskey(response, "return"));
QDECREF(response);
}
As argued elsewhere, it's less code to maintain if we convert from a dynamic string passed to qobject_from_jsonv() to instead use a hand-built QDict. Signed-off-by: Eric Blake <eblake@redhat.com> --- tests/tmp105-test.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)