[base] Thinko: Remove free function pointer.

We don't copy keys or values while hashing.

* include/freetype/internal/fthash.h (FT_Hash_FreeFunc): Removed.
(FT_HashRec): Remove `free' field.

* src/base/fthash.c (hash_str_free): Removed.
(ft_hash_init, ft_hash_free): Updated.
This commit is contained in:
Werner Lemberg 2015-12-20 19:00:35 +01:00
parent 76e79ec9a5
commit 1caf629eef
3 changed files with 14 additions and 20 deletions

View File

@ -1,3 +1,15 @@
2015-12-20 Werner Lemberg <wl@gnu.org>
[base] Thinko: Remove free function pointer.
We don't copy keys or values while hashing.
* include/freetype/internal/fthash.h (FT_Hash_FreeFunc): Removed.
(FT_HashRec): Remove `free' field.
* src/base/fthash.c (hash_str_free): Removed.
(ft_hash_init, ft_hash_free): Updated.
2015-12-20 Werner Lemberg <wl@gnu.org>
[base, bdf] Don't expose `FT_Hashnode' in hash functions.

View File

@ -75,10 +75,6 @@ FT_BEGIN_HEADER
(*FT_Hash_CompareFunc)( FT_Hashkey* a,
FT_Hashkey* b );
typedef void
(*FT_Hash_FreeFunc)( FT_Hashnode hn,
FT_Memory memory );
typedef struct FT_HashRec_
{
@ -88,7 +84,6 @@ FT_BEGIN_HEADER
FT_Hash_LookupFunc lookup;
FT_Hash_CompareFunc compare;
FT_Hash_FreeFunc free;
FT_Hashnode* table;

View File

@ -101,14 +101,6 @@
}
static void
hash_str_free( FT_Hashnode hn,
FT_Memory memory )
{
FT_FREE( hn );
}
static FT_Hashnode*
hash_bucket( FT_Hashkey key,
FT_Hash hash )
@ -186,13 +178,11 @@
{
hash->lookup = hash_num_lookup;
hash->compare = hash_num_compare;
hash->free = NULL;
}
else
{
hash->lookup = hash_str_lookup;
hash->compare = hash_str_compare;
hash->free = hash_str_free;
}
FT_MEM_NEW_ARRAY( hash->table, sz );
@ -212,11 +202,8 @@
FT_UInt i;
if ( hash->free )
{
for ( i = 0; i < sz; i++, bp++ )
(hash->free)( *bp, memory );
}
for ( i = 0; i < sz; i++, bp++ )
FT_FREE( *bp );
FT_FREE( hash->table );
}