diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-29 22:12:00 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-29 22:26:00 +0000 |
commit | 91834fbdee40f46e18d071fd2671a7a642e6aa86 (patch) | |
tree | 90e5bc4bf85b63981c225b94ede179988f4ccd8d /src/cairo-xlib-surface-shm.c | |
parent | 89092b97b50a7740058d0f72f94dfc6defe15ed6 (diff) |
xlib/shm: Clarify testing of seqno
Rename the seqno tests into seqno_passed(), seqno_before() and
seqno_after() in order to clarify their semantics.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-xlib-surface-shm.c')
-rw-r--r-- | src/cairo-xlib-surface-shm.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c index 32c70330..8ac765e6 100644 --- a/src/cairo-xlib-surface-shm.c +++ b/src/cairo-xlib-surface-shm.c @@ -221,6 +221,18 @@ seqno_passed (unsigned long a, unsigned long b) return (long)(b - a) >= 0; } +static inline cairo_bool_t +seqno_before (unsigned long a, unsigned long b) +{ + return (long)(b - a) > 0; +} + +static inline cairo_bool_t +seqno_after (unsigned long a, unsigned long b) +{ + return (long)(a - b) > 0; +} + static inline cairo_status_t _pqueue_init (struct pqueue *pq) { @@ -424,7 +436,7 @@ static void send_event(cairo_xlib_display_t *display, { XShmCompletionEvent ev; - if (seqno_passed (seqno, display->shm->last_event)) + if (seqno_before (seqno, display->shm->last_event)) return; ev.type = display->shm->event; @@ -471,7 +483,7 @@ _cairo_xlib_shm_info_cleanup (cairo_xlib_display_t *display) info = PQ_TOP(pq); do { - if (! seqno_passed (info->last_request, processed)) { + if (seqno_after (info->last_request, processed)) { send_event (display, info, display->shm->last_request); return; } @@ -544,7 +556,7 @@ _cairo_xlib_shm_pool_cleanup (cairo_xlib_display_t *display) cairo_list_foreach_entry_safe (pool, next, cairo_xlib_shm_t, &display->shm->pool, link) { - if (! seqno_passed (pool->attached, processed)) + if (seqno_before (pool->attached, processed)) break; if (pool->mem.free_bytes == pool->mem.max_bytes) @@ -720,7 +732,7 @@ _cairo_xlib_shm_surface_finish (void *abstract_surface) if (active (shm, display->display)) { shm->info->last_request = shm->active; _pqueue_push (&display->shm->info, shm->info); - if (! seqno_passed (display->shm->last_request, shm->active)) + if (seqno_before (display->shm->last_request, shm->active)) display->shm->last_request = shm->active; } else { _cairo_mempool_free (&shm->info->pool->mem, shm->info->mem); |