[PATCH v2 2/9] Xext: localise use of IdleTimeCounter
Peter Hutterer
peter.hutterer at who-t.net
Wed Mar 14 21:10:23 PDT 2012
Instead of referring to the global IdleTimeCounter everywhere, only do it
once and use a local variable for the rest.
Cleanup for future features, no functional changes.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
---
Xext/sync.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/Xext/sync.c b/Xext/sync.c
index 6767b05..5806dc4 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -2715,16 +2715,17 @@ IdleTimeQueryValue (pointer pCounter, CARD64 *pValue_return)
static void
IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
{
+ SyncCounter *counter = IdleTimeCounter;
XSyncValue idle, old_idle;
- SyncTriggerList *list = IdleTimeCounter->sync.pTriglist;
+ SyncTriggerList *list = counter->sync.pTriglist;
SyncTrigger *trig;
if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
return;
- old_idle = IdleTimeCounter->value;
+ old_idle = counter->value;
IdleTimeQueryValue (NULL, &idle);
- IdleTimeCounter->value = idle; /* push, so CheckTrigger works */
+ counter->value = idle; /* push, so CheckTrigger works */
if (pIdleTimeValueLess &&
XSyncValueLessOrEqual (idle, *pIdleTimeValueLess))
@@ -2737,7 +2738,7 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
* immediately so we can reschedule.
*/
- for (list = IdleTimeCounter->sync.pTriglist; list; list = list->next) {
+ for (list = counter->sync.pTriglist; list; list = list->next) {
trig = list->pTrigger;
if (trig->CheckTrigger(trig, old_idle)) {
AdjustWaitForDelay(wt, 0);
@@ -2771,7 +2772,7 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
idle, &overflow);
timeout = min(timeout, XSyncValueLow32 (value));
} else {
- for (list = IdleTimeCounter->sync.pTriglist; list; list = list->next) {
+ for (list = counter->sync.pTriglist; list; list = list->next) {
trig = list->pTrigger;
if (trig->CheckTrigger(trig, old_idle)) {
timeout = min(timeout, 0);
@@ -2783,12 +2784,13 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
AdjustWaitForDelay (wt, timeout);
}
- IdleTimeCounter->value = old_idle; /* pop */
+ counter->value = old_idle; /* pop */
}
static void
IdleTimeWakeupHandler (pointer env, int rc, pointer LastSelectMask)
{
+ SyncCounter *counter = IdleTimeCounter;
XSyncValue idle;
if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
@@ -2801,7 +2803,7 @@ IdleTimeWakeupHandler (pointer env, int rc, pointer LastSelectMask)
(pIdleTimeValueLess &&
XSyncValueLessOrEqual (idle, *pIdleTimeValueLess)))
{
- SyncChangeCounter (IdleTimeCounter, idle);
+ SyncChangeCounter (counter, idle);
}
}
--
1.7.7.6
More information about the xorg-devel
mailing list