summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-connection.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-08-01 19:01:16 +0200
committerAndrea Canciani <ranma42@gmail.com>2011-08-01 19:21:48 +0200
commit400d055f3cd2eecd2cc4b91a40eac4146ec61932 (patch)
treea2e61cb2871348bd5c194e8a218c4fa063f080be /src/cairo-xcb-connection.c
parent02665975d3ef0204bc512de1be55f898637f2d21 (diff)
downloadcairo-400d055f3cd2eecd2cc4b91a40eac4146ec61932.tar.gz
hash: Compare hash values before calling keys_equal
If the hash value is different, the keys cannot be equal. Testing this beforehand can avoid a few function calls and shares this optimization across all cairo-hash uses.
Diffstat (limited to 'src/cairo-xcb-connection.c')
-rw-r--r--src/cairo-xcb-connection.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/cairo-xcb-connection.c b/src/cairo-xcb-connection.c
index 3cba883c2..b25264848 100644
--- a/src/cairo-xcb-connection.c
+++ b/src/cairo-xcb-connection.c
@@ -500,13 +500,6 @@ _device_flush (void *device)
return CAIRO_STATUS_SUCCESS;
}
-static cairo_bool_t
-_xrender_formats_equal (const void *A, const void *B)
-{
- const cairo_xcb_xrender_format_t *a = A, *b = B;
- return a->key.hash == b->key.hash;
-}
-
static void
_pluck_xrender_format (void *entry,
void *closure)
@@ -633,7 +626,7 @@ _cairo_xcb_connection_get (xcb_connection_t *xcb_connection)
cairo_list_init (&connection->fonts);
cairo_list_init (&connection->screens);
cairo_list_init (&connection->link);
- connection->xrender_formats = _cairo_hash_table_create (_xrender_formats_equal);
+ connection->xrender_formats = _cairo_hash_table_create (NULL);
if (connection->xrender_formats == NULL) {
CAIRO_MUTEX_FINI (connection->device.mutex);
free (connection);
@@ -641,7 +634,7 @@ _cairo_xcb_connection_get (xcb_connection_t *xcb_connection)
goto unlock;
}
- connection->visual_to_xrender_format = _cairo_hash_table_create (_xrender_formats_equal);
+ connection->visual_to_xrender_format = _cairo_hash_table_create (NULL);
if (connection->visual_to_xrender_format == NULL) {
_cairo_hash_table_destroy (connection->xrender_formats);
CAIRO_MUTEX_FINI (connection->device.mutex);