diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-12 15:27:56 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-22 13:12:55 +1000 |
commit | 43eb2f2758dfc6ca5a49afce97cc5baea8caf9f5 (patch) | |
tree | 8605694c092d2b44dcbab62184a6dfde4bb5c5f2 /Xext | |
parent | 1f12f059ef994e0b9b68fbd1f1556d0285c96b8b (diff) |
Xext: localise use of IdleTimeCounter
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@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: James Jones <jajones@nvidia.com>
Diffstat (limited to 'Xext')
-rw-r--r-- | Xext/sync.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Xext/sync.c b/Xext/sync.c index fe0eac0e7..54a9fbb9d 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -2595,16 +2595,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)) { /* @@ -2615,7 +2616,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); @@ -2648,7 +2649,7 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask) timeout = min(timeout, XSyncValueLow32(value)); } else { - for (list = IdleTimeCounter->sync.pTriglist; list; + for (list = counter->sync.pTriglist; list; list = list->next) { trig = list->pTrigger; if (trig->CheckTrigger(trig, old_idle)) { @@ -2661,12 +2662,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) @@ -2678,7 +2680,7 @@ IdleTimeWakeupHandler(pointer env, int rc, pointer LastSelectMask) XSyncValueGreaterOrEqual(idle, *pIdleTimeValueGreater)) || (pIdleTimeValueLess && XSyncValueLessOrEqual(idle, *pIdleTimeValueLess))) { - SyncChangeCounter(IdleTimeCounter, idle); + SyncChangeCounter(counter, idle); } } |