Received: from [140.186.70.92] (port=41367 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PKxwB-0001c2-0T for qemu-devel@nongnu.org; Tue, 23 Nov 2010 13:49:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PKxw9-0005rr-Ut for qemu-devel@nongnu.org; Tue, 23 Nov 2010 13:49:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:14756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PKxw9-0005rl-Nz for qemu-devel@nongnu.org; Tue, 23 Nov 2010 13:49:53 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oANInqxQ005378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 23 Nov 2010 13:49:53 -0500 Received: from localhost ([10.3.113.10]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oANInpWj021027 for ; Tue, 23 Nov 2010 13:49:52 -0500 From: Luiz Capitulino Date: Tue, 23 Nov 2010 16:49:35 -0200 Message-Id: <1290538175-2437-4-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1290538175-2437-1-git-send-email-lcapitulino@redhat.com> References: <1290538175-2437-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 3/3] QMP: Simplify monitor_json_emitter() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 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 30be273..f6f2264 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.2.245.g03276