Received: from eggs.gnu.org ([2001:4830:134:3::10]:43265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1nnj-0005Tc-P9 for qemu-devel@nongnu.org; Thu, 18 Dec 2014 22:00:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1nnW-0002QS-HP for qemu-devel@nongnu.org; Thu, 18 Dec 2014 22:00:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1nnW-0002Pc-AN for qemu-devel@nongnu.org; Thu, 18 Dec 2014 22:00:10 -0500 From: Eduardo Habkost Date: Fri, 19 Dec 2014 00:59:45 -0200 Message-Id: <1418957987-28511-2-git-send-email-ehabkost@redhat.com> In-Reply-To: <1418957987-28511-1-git-send-email-ehabkost@redhat.com> References: <1418957987-28511-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH RESEND v2 1/3] vl: Avoid unnecessary 'if' nesting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Andrew Jones , Peter Lieven Just a coding style change, to make other changes easier to review. Signed-off-by: Eduardo Habkost Reviewed-by: Andrew Jones --- vl.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vl.c b/vl.c index 113e98e..3b7157d 100644 --- a/vl.c +++ b/vl.c @@ -1300,13 +1300,11 @@ static void smp_parse(QemuOpts *opts) if (cpus == 0) { cpus = cores * threads * sockets; } + } else if (cores == 0) { + threads = threads > 0 ? threads : 1; + cores = cpus / (sockets * threads); } else { - if (cores == 0) { - threads = threads > 0 ? threads : 1; - cores = cpus / (sockets * threads); - } else { - threads = cpus / (cores * sockets); - } + threads = cpus / (cores * sockets); } max_cpus = qemu_opt_get_number(opts, "maxcpus", 0); -- 1.9.3