Patchwork [3/4] QMP: Simplify monitor_json_emitter()

login
register
mail settings
Submitter Luiz Capitulino
Date Dec. 6, 2010, 2:43 p.m.
Message ID <1291646631-4609-4-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/74373/
State New
Headers show

Comments

Luiz Capitulino - Dec. 6, 2010, 2:43 p.m.
Use the ternary operator instead of an if (also fixes bad indentation).

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

Patch

diff --git a/monitor.c b/monitor.c
index 1e8b1fc..f1aebc1 100644
--- a/monitor.c
+++ b/monitor.c
@@ -351,10 +351,8 @@  static void monitor_json_emitter(Monitor *mon, const QObject *data)
 {
     QString *json;
 
-    if (mon->flags & MONITOR_USE_PRETTY)
-	json = qobject_to_json_pretty(data);
-    else
-	json = qobject_to_json(data);
+    json = mon->flags & MONITOR_USE_PRETTY ? qobject_to_json_pretty(data) :
+                                             qobject_to_json(data);
     assert(json != NULL);
 
     qstring_append_chr(json, '\n');