diff options
author | Grigori Goronzy <greg@blackbox> | 2009-08-06 13:04:20 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2009-08-06 13:15:17 +0200 |
commit | 892423a588aea8fb14e84bdb9527df97e945ec57 (patch) | |
tree | ca98694d710a7b276b79e278fe06579736a5cdc9 /libass/ass_cache.h | |
parent | 5ddad362f52080c4f2a46e78fc4cca4f8ca6a2b0 (diff) | |
download | libass-892423a588aea8fb14e84bdb9527df97e945ec57.tar.bz2 libass-892423a588aea8fb14e84bdb9527df97e945ec57.tar.xz |
Rename typedefs (breaks API)
Rename all typedefs from the convention foo_bar_t, which can possibly
conflict with POSIX types, to FooBar (and ASS_FooBar for public
API typedefs). Fix formatting and stray comments while at it.
Diffstat (limited to 'libass/ass_cache.h')
-rw-r--r-- | libass/ass_cache.h | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/libass/ass_cache.h b/libass/ass_cache.h index c2c6d2a4..5c9749f8 100644 --- a/libass/ass_cache.h +++ b/libass/ass_cache.h @@ -25,79 +25,79 @@ #include "ass_font.h" #include "ass_bitmap.h" -typedef void (*hashmap_item_dtor_t) (void *key, size_t key_size, - void *value, size_t value_size); -typedef int (*hashmap_key_compare_t) (void *key1, void *key2, - size_t key_size); -typedef unsigned (*hashmap_hash_t) (void *key, size_t key_size); +typedef void (*HashmapItemDtor) (void *key, size_t key_size, + void *value, size_t value_size); +typedef int (*HashmapKeyCompare) (void *key1, void *key2, + size_t key_size); +typedef unsigned (*HashmapHash) (void *key, size_t key_size); typedef struct hashmap_item { void *key; void *value; struct hashmap_item *next; -} hashmap_item_t; -typedef hashmap_item_t *hashmap_item_p; +} HashmapItem; +typedef HashmapItem *hashmap_item_p; typedef struct { int nbuckets; size_t key_size, value_size; hashmap_item_p *root; - hashmap_item_dtor_t item_dtor; // a destructor for hashmap key/value pairs - hashmap_key_compare_t key_compare; - hashmap_hash_t hash; + HashmapItemDtor item_dtor; // a destructor for hashmap key/value pairs + HashmapKeyCompare key_compare; + HashmapHash hash; size_t cache_size; // stats int hit_count; int miss_count; int count; - ass_library_t *library; -} hashmap_t; - -hashmap_t *hashmap_init(ass_library_t *library, size_t key_size, - size_t value_size, int nbuckets, - hashmap_item_dtor_t item_dtor, - hashmap_key_compare_t key_compare, - hashmap_hash_t hash); -void hashmap_done(hashmap_t *map); -void *hashmap_insert(hashmap_t *map, void *key, void *value); -void *hashmap_find(hashmap_t *map, void *key); - -hashmap_t *ass_font_cache_init(ass_library_t *library); -ass_font_t *ass_font_cache_find(hashmap_t *, ass_font_desc_t *desc); -void *ass_font_cache_add(hashmap_t *, ass_font_t *font); -void ass_font_cache_done(hashmap_t *); + ASS_Library *library; +} Hashmap; + +Hashmap *hashmap_init(ASS_Library *library, size_t key_size, + size_t value_size, int nbuckets, + HashmapItemDtor item_dtor, + HashmapKeyCompare key_compare, + HashmapHash hash); +void hashmap_done(Hashmap *map); +void *hashmap_insert(Hashmap *map, void *key, void *value); +void *hashmap_find(Hashmap *map, void *key); + +Hashmap *ass_font_cache_init(ASS_Library *library); +ASS_Font *ass_font_cache_find(Hashmap *, ASS_FontDesc *desc); +void *ass_font_cache_add(Hashmap *, ASS_Font *font); +void ass_font_cache_done(Hashmap *); // Create definitions for bitmap_hash_key and glyph_hash_key #define CREATE_STRUCT_DEFINITIONS #include "ass_cache_template.h" typedef struct { - bitmap_t *bm; // the actual bitmaps - bitmap_t *bm_o; - bitmap_t *bm_s; -} bitmap_hash_val_t; + Bitmap *bm; // the actual bitmaps + Bitmap *bm_o; + Bitmap *bm_s; +} BitmapHashValue; -hashmap_t *ass_bitmap_cache_init(ass_library_t *library); -void *cache_add_bitmap(hashmap_t *, bitmap_hash_key_t *key, - bitmap_hash_val_t *val); -bitmap_hash_val_t *cache_find_bitmap(hashmap_t *bitmap_cache, - bitmap_hash_key_t *key); -hashmap_t *ass_bitmap_cache_reset(hashmap_t *bitmap_cache); -void ass_bitmap_cache_done(hashmap_t *bitmap_cache); +Hashmap *ass_bitmap_cache_init(ASS_Library *library); +void *cache_add_bitmap(Hashmap *, BitmapHashKey *key, + BitmapHashValue *val); +BitmapHashValue *cache_find_bitmap(Hashmap *bitmap_cache, + BitmapHashKey *key); +Hashmap *ass_bitmap_cache_reset(Hashmap *bitmap_cache); +void ass_bitmap_cache_done(Hashmap *bitmap_cache); typedef struct { unsigned char *a; unsigned char *b; -} composite_hash_val_t; +} CompositeHashValue; -hashmap_t *ass_composite_cache_init(ass_library_t *library); -void *cache_add_composite(hashmap_t *, composite_hash_key_t *key, - composite_hash_val_t *val); -composite_hash_val_t *cache_find_composite(hashmap_t *composite_cache, - composite_hash_key_t *key); -hashmap_t *ass_composite_cache_reset(hashmap_t *composite_cache); -void ass_composite_cache_done(hashmap_t *composite_cache); +Hashmap *ass_composite_cache_init(ASS_Library *library); +void *cache_add_composite(Hashmap *, CompositeHashKey *key, + CompositeHashValue *val); +CompositeHashValue *cache_find_composite(Hashmap *composite_cache, + CompositeHashKey *key); +Hashmap *ass_composite_cache_reset(Hashmap *composite_cache); +void ass_composite_cache_done(Hashmap *composite_cache); typedef struct { @@ -106,14 +106,14 @@ typedef struct { FT_BBox bbox_scaled; // bbox after scaling, but before rotation FT_Vector advance; // 26.6, advance distance to the next bitmap in line int asc, desc; // ascender/descender of a drawing -} glyph_hash_val_t; - -hashmap_t *ass_glyph_cache_init(ass_library_t *library); -void *cache_add_glyph(hashmap_t *, glyph_hash_key_t *key, - glyph_hash_val_t *val); -glyph_hash_val_t *cache_find_glyph(hashmap_t *glyph_cache, - glyph_hash_key_t *key); -hashmap_t *ass_glyph_cache_reset(hashmap_t *glyph_cache); -void ass_glyph_cache_done(hashmap_t *glyph_cache); +} GlyphHashValue; + +Hashmap *ass_glyph_cache_init(ASS_Library *library); +void *cache_add_glyph(Hashmap *, GlyphHashKey *key, + GlyphHashValue *val); +GlyphHashValue *cache_find_glyph(Hashmap *glyph_cache, + GlyphHashKey *key); +Hashmap *ass_glyph_cache_reset(Hashmap *glyph_cache); +void ass_glyph_cache_done(Hashmap *glyph_cache); #endif /* LIBASS_CACHE_H */ |