From patchwork Fri Feb 15 14:47:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 220753 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E3ED02C0089 for ; Sat, 16 Feb 2013 01:48:10 +1100 (EST) Received: from localhost ([::1]:43392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6Ma8-0003ad-EA for incoming@patchwork.ozlabs.org; Fri, 15 Feb 2013 09:48:08 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6MZx-0003aN-Te for qemu-devel@nongnu.org; Fri, 15 Feb 2013 09:48:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6MZs-0000dl-Oh for qemu-devel@nongnu.org; Fri, 15 Feb 2013 09:47:57 -0500 Received: from cantor2.suse.de ([195.135.220.15]:58342 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6MZs-0000dd-Iq for qemu-devel@nongnu.org; Fri, 15 Feb 2013 09:47:52 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B7E2FA41E0; Fri, 15 Feb 2013 15:47:51 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Fri, 15 Feb 2013 15:47:41 +0100 Message-Id: <1360939661-23623-1-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH qom-cpu-next] cpus: Replace open-coded CPU loop in qmp_memsave() with qemu_get_cpu() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org No functional change, just less usages of first_cpu and next_cpu fields. Signed-off-by: Andreas Färber Reviewed-by: Luiz Capitulino --- cpus.c | 11 +++-------- 1 Datei geändert, 3 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-) diff --git a/cpus.c b/cpus.c index 41779eb..845e915 100644 --- a/cpus.c +++ b/cpus.c @@ -1262,18 +1262,13 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename, cpu_index = 0; } - for (env = first_cpu; env; env = env->next_cpu) { - cpu = ENV_GET_CPU(env); - if (cpu_index == cpu->cpu_index) { - break; - } - } - - if (env == NULL) { + cpu = qemu_get_cpu(cpu_index); + if (cpu == NULL) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index", "a CPU number"); return; } + env = cpu->env_ptr; f = fopen(filename, "wb"); if (!f) {