From patchwork Sun Sep 23 10:00:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 186200 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 117EA2C0093 for ; Sun, 23 Sep 2012 20:43:19 +1000 (EST) Received: from localhost ([::1]:47390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFj0M-00060g-TN for incoming@patchwork.ozlabs.org; Sun, 23 Sep 2012 06:01:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFizY-0004SH-2R for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TFizX-0007iE-4E for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:47 -0400 Received: from mail-we0-f173.google.com ([74.125.82.173]:56749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFizW-0007Xh-U1 for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:47 -0400 Received: by mail-we0-f173.google.com with SMTP id t11so2574474wey.4 for ; Sun, 23 Sep 2012 03:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=avbW9J7RlDu3TietG/lMpPmYlwCZN8vbXt//NN1Ee94=; b=APzYV2QXPLZqXcuRtdLW0DlADcHnxBouH5L1+iBekz2ptgPgLGUeLxOJ/vPHE1R3Vl rCQXa+Nr3ONnLGam/iNhrPiBhQvOdCK9Krx0O/jvsinfbl+VKj85vWGemmdHnXlupt+R /CRc84jMvQCcvbg8xpjMCxiUvCh75onr5vpWTc8iH4gGcILywoev0n8Ue8XTK0fv1pI7 rBPwZ95K0KPjNHJd+hcc4Hhzgq8lDI34zU5gCkWa1jHrt2deAHGPYk/zy7rqiQs4pMZh x31Gm2PkQiAXNvUg66NOQWew3BIngaqhPTLRJrvFN6lNv4se7GW+DGyc9hCus+rcu8G2 J4Fg== Received: by 10.216.207.163 with SMTP id n35mr5642204weo.220.1348394446466; Sun, 23 Sep 2012 03:00:46 -0700 (PDT) Received: from localhost ([109.224.133.37]) by mx.google.com with ESMTPS id ct3sm8305056wib.5.2012.09.23.03.00.45 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Sep 2012 03:00:46 -0700 (PDT) From: Stefan Hajnoczi To: Anthony Liguori Date: Sun, 23 Sep 2012 11:00:17 +0100 Message-Id: <1348394420-28298-12-git-send-email-stefanha@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1348394420-28298-1-git-send-email-stefanha@gmail.com> References: <1348394420-28298-1-git-send-email-stefanha@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.173 Cc: Paolo Bonzini , qemu-devel@nongnu.org, Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 11/14] qemu-timer: simplify qemu_run_timers 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 From: Paolo Bonzini ptimer_head is an invariant pointer to clock->active_timers. Remove it, and just reference clock->active_timers directly. Signed-off-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi --- qemu-timer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qemu-timer.c b/qemu-timer.c index c7a1551..908a103 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -372,21 +372,20 @@ bool qemu_timer_expired(QEMUTimer *timer_head, int64_t current_time) void qemu_run_timers(QEMUClock *clock) { - QEMUTimer **ptimer_head, *ts; + QEMUTimer *ts; int64_t current_time; if (!clock->enabled) return; current_time = qemu_get_clock_ns(clock); - ptimer_head = &clock->active_timers; for(;;) { - ts = *ptimer_head; + ts = clock->active_timers; if (!qemu_timer_expired_ns(ts, current_time)) { break; } /* remove timer from the list before calling the callback */ - *ptimer_head = ts->next; + clock->active_timers = ts->next; ts->next = NULL; /* run the callback (the timer list can be modified) */