[MPlayer-cvslog] r23229 - in trunk/libass: ass_cache.c ass_cache.h
eugeni
subversion at mplayerhq.hu
Thu May 3 21:13:55 CEST 2007
Author: eugeni
Date: Thu May 3 21:13:54 2007
New Revision: 23229
Log:
Make cache_*_add functions return the pointer to new (copied) value.
Modified:
trunk/libass/ass_cache.c
trunk/libass/ass_cache.h
Modified: trunk/libass/ass_cache.c
==============================================================================
--- trunk/libass/ass_cache.c (original)
+++ trunk/libass/ass_cache.c Thu May 3 21:13:54 2007
@@ -130,7 +130,7 @@ void hashmap_done(hashmap_t* map)
}
// does nothing if key already exists
-void hashmap_insert(hashmap_t* map, void* key, void* value)
+void* hashmap_insert(hashmap_t* map, void* key, void* value)
{
unsigned hash = map->hash(key, map->key_size);
hashmap_item_t** next = map->root + (hash % map->nbuckets);
@@ -148,6 +148,7 @@ void hashmap_insert(hashmap_t* map, void
(*next)->next = 0;
map->count ++;
+ return (*next)->value;
}
void* hashmap_find(hashmap_t* map, void* key)
@@ -207,9 +208,9 @@ ass_font_t* ass_font_cache_find(ass_font
* \brief Add a face struct to cache.
* \param font font struct
*/
-void ass_font_cache_add(ass_font_t* font)
+void* ass_font_cache_add(ass_font_t* font)
{
- hashmap_insert(font_cache, &(font->desc), font);
+ return hashmap_insert(font_cache, &(font->desc), font);
}
void ass_font_cache_init(void)
@@ -240,9 +241,9 @@ static void bitmap_hash_dtor(void* key,
free(value);
}
-void cache_add_bitmap(bitmap_hash_key_t* key, bitmap_hash_val_t* val)
+void* cache_add_bitmap(bitmap_hash_key_t* key, bitmap_hash_val_t* val)
{
- hashmap_insert(bitmap_cache, key, val);
+ return hashmap_insert(bitmap_cache, key, val);
}
/**
@@ -288,9 +289,9 @@ static void glyph_hash_dtor(void* key, s
free(value);
}
-void cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val)
+void* cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val)
{
- hashmap_insert(glyph_cache, key, val);
+ return hashmap_insert(glyph_cache, key, val);
}
/**
Modified: trunk/libass/ass_cache.h
==============================================================================
--- trunk/libass/ass_cache.h (original)
+++ trunk/libass/ass_cache.h Thu May 3 21:13:54 2007
@@ -23,7 +23,7 @@
void ass_font_cache_init(void);
ass_font_t* ass_font_cache_find(ass_font_desc_t* desc);
-void ass_font_cache_add(ass_font_t* font);
+void* ass_font_cache_add(ass_font_t* font);
void ass_font_cache_done(void);
@@ -53,7 +53,7 @@ typedef struct bitmap_hash_val_s {
} bitmap_hash_val_t;
void ass_bitmap_cache_init(void);
-void cache_add_bitmap(bitmap_hash_key_t* key, bitmap_hash_val_t* val);
+void* cache_add_bitmap(bitmap_hash_key_t* key, bitmap_hash_val_t* val);
bitmap_hash_val_t* cache_find_bitmap(bitmap_hash_key_t* key);
void ass_bitmap_cache_reset(void);
void ass_bitmap_cache_done(void);
@@ -77,7 +77,7 @@ typedef struct glyph_hash_val_s {
} glyph_hash_val_t;
void ass_glyph_cache_init(void);
-void cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val);
+void* cache_add_glyph(glyph_hash_key_t* key, glyph_hash_val_t* val);
glyph_hash_val_t* cache_find_glyph(glyph_hash_key_t* key);
void ass_glyph_cache_reset(void);
void ass_glyph_cache_done(void);
@@ -91,7 +91,7 @@ hashmap_t* hashmap_init(size_t key_size,
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_insert(hashmap_t* map, void* key, void* value);
void* hashmap_find(hashmap_t* map, void* key);
#endif
More information about the MPlayer-cvslog
mailing list