From patchwork Wed Sep 19 13:52:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 185046 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 EB77A2C0081 for ; Wed, 19 Sep 2012 23:53:20 +1000 (EST) Received: from localhost ([::1]:53248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEKiM-0004L8-F0 for incoming@patchwork.ozlabs.org; Wed, 19 Sep 2012 09:53:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEKi9-0004KQ-8L for qemu-devel@nongnu.org; Wed, 19 Sep 2012 09:53:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEKi3-0006xl-C9 for qemu-devel@nongnu.org; Wed, 19 Sep 2012 09:53:05 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:50109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEKi3-0006xT-4I; Wed, 19 Sep 2012 09:52:59 -0400 Received: by pbbrp12 with SMTP id rp12so2508785pbb.4 for ; Wed, 19 Sep 2012 06:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=PxojQF1Wnh1YiJudTd4KfF3GmK1MgBFg6Dzxbw6LnW4=; b=j2CjEBB1Ns5L5wpRs+sWzCqoOHSDnE7vzA/gWIJrDfi/9OJdpDy6Wwty6HzHnYkmPK OSk6LLZw8rQgdjKOJzwrYj21dB5dh4l4UFtkRkmBlParzkaj/x9pcgl7fbsk5FmSWbYY szVLwfqE7WDfX4N3x9m/gz1zpzqG5ldgJMxN6bhAdqsjt2td1Q4TYLmUT1SykfV0Hkg8 ISAWFQ802aUSDVBh8pJncb7PCEWEwNr4I0L07ZmcXkcjDYes35Vy9/7A8UbodX9ZDjC6 S244ERxEAMnZtqfTAFPuU5v60VjniPsSgE+0MCe6cXsyRlZMhIEBMpS2DVhrrgen7COc TZVQ== Received: by 10.66.83.234 with SMTP id t10mr7045482pay.39.1348062778190; Wed, 19 Sep 2012 06:52:58 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id ih2sm1870105pbc.65.2012.09.19.06.52.55 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Sep 2012 06:52:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 19 Sep 2012 15:52:44 +0200 Message-Id: <1348062764-30806-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: qemu-trivial@nongnu.org Subject: [Qemu-devel] [PATCH] 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 ptimer_head is an invariant pointer to clock->active_timers. Remove it, and just reference clock->active_timers directly. Signed-off-by: Paolo Bonzini --- qemu-timer.c | 7 +++---- 1 file modificato, 3 inserzioni(+), 4 rimozioni(-) 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) */