[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
diff --git a/ChangeLog b/ChangeLog
index fc484fa..7e62e2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
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.
* src/base/fthash.c (hash_lookup, ft_hash_str_lookup,
diff --git a/include/freetype/internal/fthash.h b/include/freetype/internal/fthash.h
index 7867e12..578d56b 100644
--- a/include/freetype/internal/fthash.h
+++ b/include/freetype/internal/fthash.h
@@ -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;
diff --git a/src/base/fthash.c b/src/base/fthash.c
index 854741a..ff90f56 100644
--- a/src/base/fthash.c
+++ b/src/base/fthash.c
@@ -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 );
}