diff options
author | Alon Levy <alevy@redhat.com> | 2011-04-24 13:42:03 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-08-23 18:05:42 +0300 |
commit | c820b252c1a7a9ac6574ed5c461c90a7bc569ba9 (patch) | |
tree | 3ca3067ec06175f25fded841a2e9838d7ba26dcb /server | |
parent | f4d07791cc0c85abf9e886878eddf070b6f838ca (diff) | |
download | spice-c820b252c1a7a9ac6574ed5c461c90a7bc569ba9.tar.gz spice-c820b252c1a7a9ac6574ed5c461c90a7bc569ba9.tar.xz spice-c820b252c1a7a9ac6574ed5c461c90a7bc569ba9.zip |
server/red_worker: DEBUG_CURSORS
Add cursor allocation debugging code that is turned off as long as
DEBUG_CURSORS is not defined.
Diffstat (limited to 'server')
-rw-r--r-- | server/red_worker.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/red_worker.c b/server/red_worker.c index c264a412..ddd34c65 100644 --- a/server/red_worker.c +++ b/server/red_worker.c @@ -81,6 +81,7 @@ //#define DRAW_ALL //#define COMPRESS_DEBUG //#define ACYCLIC_SURFACE_DEBUG +//#define DEBUG_CURSORS //#define UPDATE_AREA_BY_TREE @@ -4480,12 +4481,20 @@ static void red_set_cursor(RedWorker *worker, CursorItem *cursor) worker->cursor = cursor; } +#ifdef DEBUG_CURSORS +static int _cursor_count = 0; +#endif + static inline CursorItem *alloc_cursor_item(RedWorker *worker) { CursorItem *cursor; + if (!worker->free_cursor_items) { return NULL; } +#ifdef DEBUG_CURSORS + --_cursor_count; +#endif cursor = &worker->free_cursor_items->u.cursor_item; worker->free_cursor_items = worker->free_cursor_items->u.next; return cursor; @@ -4495,6 +4504,10 @@ static inline void free_cursor_item(RedWorker *worker, CursorItem *item) { ((_CursorItem *)item)->u.next = worker->free_cursor_items; worker->free_cursor_items = (_CursorItem *)item; +#ifdef DEBUG_CURSORS + ++_cursor_count; + ASSERT(_cursor_count <= NUM_CURSORS); +#endif } static void cursor_items_init(RedWorker *worker) |