Received: from [140.186.70.92] (port=53643 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPcIQ-0003W6-Tx for qemu-devel@nongnu.org; Mon, 06 Dec 2010 09:44:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPcIP-00056Q-Fx for qemu-devel@nongnu.org; Mon, 06 Dec 2010 09:44:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPcIP-000561-9F for qemu-devel@nongnu.org; Mon, 06 Dec 2010 09:44:05 -0500 From: Luiz Capitulino Date: Mon, 6 Dec 2010 12:43:50 -0200 Message-Id: <1291646631-4609-4-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1291646631-4609-1-git-send-email-lcapitulino@redhat.com> References: <1291646631-4609-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 3/4] QMP: Simplify monitor_json_emitter() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: qemu-devel@nongnu.org Use the ternary operator instead of an if (also fixes bad indentation). Signed-off-by: Luiz Capitulino --- monitor.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) 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'); -- 1.7.3.3.398.g0b0cd