From 6b4e07d1430c704fc976edf63c27c46f16a8751f Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 25 Dec 2010 14:47:29 +0100 Subject: [PATCH] Switch the order of two functions in the C file The following commit adds a call to _cairo_xcb_shm_info_destroy to some function in-between, but it also renames it and does some other changes to this. Thus, move this function first to make the diff easier to read. :) Signed-off-by: Uli Schlachter --- src/cairo-xcb-shm.c | 68 ++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/cairo-xcb-shm.c b/src/cairo-xcb-shm.c index cfcf6d19d..fae020af9 100644 --- a/src/cairo-xcb-shm.c +++ b/src/cairo-xcb-shm.c @@ -412,6 +412,40 @@ _cairo_xcb_shm_mem_pool_destroy (cairo_xcb_shm_mem_pool_t *pool) free (pool); } +void +_cairo_xcb_shm_info_destroy (cairo_xcb_shm_info_t *shm_info) +{ + cairo_xcb_connection_t *connection = shm_info->connection; + + CAIRO_MUTEX_LOCK (connection->shm_mutex); + + _cairo_xcb_shm_mem_pool_free (shm_info->pool, shm_info->mem); + _cairo_freepool_free (&connection->shm_info_freelist, shm_info); + + /* scan for old, unused pools - hold at least one in reserve */ + if (! cairo_list_is_singular (&connection->shm_pools)) + { + cairo_xcb_shm_mem_pool_t *pool, *next; + cairo_list_t head; + + cairo_list_init (&head); + cairo_list_move (connection->shm_pools.next, &head); + + cairo_list_foreach_entry_safe (pool, next, cairo_xcb_shm_mem_pool_t, + &connection->shm_pools, link) + { + if (pool->free_bytes == pool->max_bytes) { + _cairo_xcb_connection_shm_detach (connection, pool->shmseg); + _cairo_xcb_shm_mem_pool_destroy (pool); + } + } + + cairo_list_move (head.next, &connection->shm_pools); + } + + CAIRO_MUTEX_UNLOCK (connection->shm_mutex); +} + cairo_int_status_t _cairo_xcb_connection_allocate_shm_info (cairo_xcb_connection_t *connection, size_t size, @@ -530,40 +564,6 @@ _cairo_xcb_connection_allocate_shm_info (cairo_xcb_connection_t *connection, return CAIRO_STATUS_SUCCESS; } -void -_cairo_xcb_shm_info_destroy (cairo_xcb_shm_info_t *shm_info) -{ - cairo_xcb_connection_t *connection = shm_info->connection; - - CAIRO_MUTEX_LOCK (connection->shm_mutex); - - _cairo_xcb_shm_mem_pool_free (shm_info->pool, shm_info->mem); - _cairo_freepool_free (&connection->shm_info_freelist, shm_info); - - /* scan for old, unused pools - hold at least one in reserve */ - if (! cairo_list_is_singular (&connection->shm_pools)) - { - cairo_xcb_shm_mem_pool_t *pool, *next; - cairo_list_t head; - - cairo_list_init (&head); - cairo_list_move (connection->shm_pools.next, &head); - - cairo_list_foreach_entry_safe (pool, next, cairo_xcb_shm_mem_pool_t, - &connection->shm_pools, link) - { - if (pool->free_bytes == pool->max_bytes) { - _cairo_xcb_connection_shm_detach (connection, pool->shmseg); - _cairo_xcb_shm_mem_pool_destroy (pool); - } - } - - cairo_list_move (head.next, &connection->shm_pools); - } - - CAIRO_MUTEX_UNLOCK (connection->shm_mutex); -} - void _cairo_xcb_connection_shm_mem_pools_fini (cairo_xcb_connection_t *connection) {