Patchwork [2/7] QMP: Return an empty dict by default

login
register
mail settings
Submitter Luiz Capitulino
Date Dec. 18, 2009, 3:25 p.m.
Message ID <1261149905-7622-3-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/41407/
State New
Headers show

Comments

Luiz Capitulino - Dec. 18, 2009, 3:25 p.m.
Currently, when a regular command doesn't have any data to output,
QMP will emit:

{ "return": "OK" }

Returning an empty dict is better though, because dicts can support
some protocol changes in a compatible way.

So, with this commit we will return:

{ "return": {} }

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 1455258..d238660 100644
--- a/monitor.c
+++ b/monitor.c
@@ -286,7 +286,8 @@  static void monitor_protocol_emitter(Monitor *mon, QObject *data)
             qobject_incref(data);
             qdict_put_obj(qmp, "return", data);
         } else {
-            qdict_put(qmp, "return", qstring_from_str("OK"));
+            /* return an empty QDict by default */
+            qdict_put(qmp, "return", qdict_new());
         }
     } else {
         /* error response */