From 737d20a5702a18a1480c3b45f876e886b82b065c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 21 Apr 2007 03:35:07 -0400 Subject: [PATCH] Move cairo_hash_entry_t to cairo-types-private.h --- src/cairo-hash-private.h | 38 --------------------------------- src/cairo-scaled-font-private.h | 2 ++ src/cairo-types-private.h | 38 +++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/src/cairo-hash-private.h b/src/cairo-hash-private.h index b3593df56..8ed3ba83a 100644 --- a/src/cairo-hash-private.h +++ b/src/cairo-hash-private.h @@ -46,44 +46,6 @@ * monolithic cairoint.h. So, for now, just include cairoint.h instead * if you want to include this file. */ -/** - * cairo_hash_entry_t: - * - * A #cairo_hash_entry_t contains both a key and a value for - * cairo_hash_table_t. User-derived types for cairo_hash_entry_t must - * be type-compatible with this structure (eg. they must have an - * unsigned long as the first parameter. The easiest way to get this - * is to use: - * - * typedef _my_entry { - * cairo_hash_entry_t base; - * ... Remainder of key and value fields here .. - * } my_entry_t; - * - * which then allows a pointer to my_entry_t to be passed to any of - * the cairo_hash_table functions as follows without requiring a cast: - * - * _cairo_hash_table_insert (hash_table, &my_entry->base); - * - * IMPORTANT: The caller is reponsible for initializing - * my_entry->base.hash with a hash code derived from the key. The - * essential property of the hash code is that keys_equal must never - * return TRUE for two keys that have different hashes. The best hash - * code will reduce the frequency of two keys with the same code for - * which keys_equal returns FALSE. - * - * Which parts of the entry make up the "key" and which part make up - * the value are entirely up to the caller, (as determined by the - * computation going into base.hash as well as the keys_equal - * function). A few of the cairo_hash_table functions accept an entry - * which will be used exclusively as a "key", (indicated by a - * parameter name of key). In these cases, the value-related fields of - * the entry need not be initialized if so desired. - **/ -typedef struct _cairo_hash_entry { - unsigned long hash; -} cairo_hash_entry_t; - typedef cairo_bool_t (*cairo_hash_keys_equal_func_t) (const void *key_a, const void *key_b); diff --git a/src/cairo-scaled-font-private.h b/src/cairo-scaled-font-private.h index a73110eb6..32d78543e 100644 --- a/src/cairo-scaled-font-private.h +++ b/src/cairo-scaled-font-private.h @@ -40,6 +40,8 @@ #include "cairo.h" +#include "cairo-types-private.h" + struct _cairo_scaled_font { /* For most cairo objects, the rule for multiple threads is that * the user is responsible for any locking if the same object is diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h index 03001827b..bbbc337ac 100644 --- a/src/cairo-types-private.h +++ b/src/cairo-types-private.h @@ -70,6 +70,44 @@ typedef struct _cairo_cache { int freeze_count; } cairo_cache_t; +/** + * cairo_hash_entry_t: + * + * A #cairo_hash_entry_t contains both a key and a value for + * cairo_hash_table_t. User-derived types for cairo_hash_entry_t must + * be type-compatible with this structure (eg. they must have an + * unsigned long as the first parameter. The easiest way to get this + * is to use: + * + * typedef _my_entry { + * cairo_hash_entry_t base; + * ... Remainder of key and value fields here .. + * } my_entry_t; + * + * which then allows a pointer to my_entry_t to be passed to any of + * the cairo_hash_table functions as follows without requiring a cast: + * + * _cairo_hash_table_insert (hash_table, &my_entry->base); + * + * IMPORTANT: The caller is reponsible for initializing + * my_entry->base.hash with a hash code derived from the key. The + * essential property of the hash code is that keys_equal must never + * return TRUE for two keys that have different hashes. The best hash + * code will reduce the frequency of two keys with the same code for + * which keys_equal returns FALSE. + * + * Which parts of the entry make up the "key" and which part make up + * the value are entirely up to the caller, (as determined by the + * computation going into base.hash as well as the keys_equal + * function). A few of the cairo_hash_table functions accept an entry + * which will be used exclusively as a "key", (indicated by a + * parameter name of key). In these cases, the value-related fields of + * the entry need not be initialized if so desired. + **/ +typedef struct _cairo_hash_entry { + unsigned long hash; +} cairo_hash_entry_t; + typedef struct _cairo_surface_backend cairo_surface_backend_t; typedef struct _cairo_clip cairo_clip_t;