From 3ddae647c307005309daa2d5dfe4bc6acb8170ab Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 12 Mar 2012 15:31:39 +1000 Subject: Xext: localise pIdleTimeValueLess/Greater Cleanup for future features, no functional changes. Signed-off-by: Peter Hutterer Reviewed-by: Jeremy Huddleston Reviewed-by: Jamey Sharp Reviewed-by: James Jones --- Xext/sync.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Xext/sync.c b/Xext/sync.c index 54a9fbb9d..0bc0fb872 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -2596,18 +2596,20 @@ static void IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask) { SyncCounter *counter = IdleTimeCounter; + XSyncValue *less = pIdleTimeValueLess, + *greater = pIdleTimeValueGreater; XSyncValue idle, old_idle; SyncTriggerList *list = counter->sync.pTriglist; SyncTrigger *trig; - if (!pIdleTimeValueLess && !pIdleTimeValueGreater) + if (!less && !greater) return; old_idle = counter->value; IdleTimeQueryValue(NULL, &idle); counter->value = idle; /* push, so CheckTrigger works */ - if (pIdleTimeValueLess && XSyncValueLessOrEqual(idle, *pIdleTimeValueLess)) { + if (less && XSyncValueLessOrEqual(idle, *less)) { /* * We've been idle for less than the threshold value, and someone * wants to know about that, but now we need to know whether they @@ -2629,10 +2631,10 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask) * idle time greater than this. Schedule a wakeup for the next * millisecond so we won't miss a transition. */ - if (XSyncValueEqual(idle, *pIdleTimeValueLess)) + if (XSyncValueEqual(idle, *less)) AdjustWaitForDelay(wt, 1); } - else if (pIdleTimeValueGreater) { + else if (greater) { /* * There's a threshold in the positive direction. If we've been * idle less than it, schedule a wakeup for sometime in the future. @@ -2641,11 +2643,11 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask) */ unsigned long timeout = -1; - if (XSyncValueLessThan(idle, *pIdleTimeValueGreater)) { + if (XSyncValueLessThan(idle, *greater)) { XSyncValue value; Bool overflow; - XSyncValueSubtract(&value, *pIdleTimeValueGreater, idle, &overflow); + XSyncValueSubtract(&value, *greater, idle, &overflow); timeout = min(timeout, XSyncValueLow32(value)); } else { @@ -2670,16 +2672,16 @@ IdleTimeWakeupHandler(pointer env, int rc, pointer LastSelectMask) { SyncCounter *counter = IdleTimeCounter; XSyncValue idle; + XSyncValue *less = pIdleTimeValueLess, + *greater = pIdleTimeValueGreater; - if (!pIdleTimeValueLess && !pIdleTimeValueGreater) + if (!less && !greater) return; IdleTimeQueryValue(NULL, &idle); - if ((pIdleTimeValueGreater && - XSyncValueGreaterOrEqual(idle, *pIdleTimeValueGreater)) || - (pIdleTimeValueLess && - XSyncValueLessOrEqual(idle, *pIdleTimeValueLess))) { + if ((greater && XSyncValueGreaterOrEqual(idle, *greater)) || + (less && XSyncValueLessOrEqual(idle, *less))) { SyncChangeCounter(counter, idle); } } @@ -2688,7 +2690,9 @@ static void IdleTimeBracketValues(pointer pCounter, CARD64 * pbracket_less, CARD64 * pbracket_greater) { - Bool registered = (pIdleTimeValueLess || pIdleTimeValueGreater); + XSyncValue *less = pIdleTimeValueLess, + *greater = pIdleTimeValueGreater; + Bool registered = (less || greater); if (registered && !pbracket_less && !pbracket_greater) { RemoveBlockAndWakeupHandlers(IdleTimeBlockHandler, -- cgit v1.2.3