shithub: freetype+ttf2subf

Download patch

ref: 1caf629eef20c5809a73f79ce6e2ffc885f125e6
parent: 76e79ec9a59bce0c5f6adc0684bb9e657843d51a
author: Werner Lemberg <[email protected]>
date: Sun Dec 20 14:00:35 EST 2015

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2015-12-20  Werner Lemberg  <[email protected]>
 
+	[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  <[email protected]>
+
 	[base, bdf] Don't expose `FT_Hashnode' in hash functions.
 
 	* src/base/fthash.c (hash_lookup, ft_hash_str_lookup,
--- a/include/freetype/internal/fthash.h
+++ b/include/freetype/internal/fthash.h
@@ -75,11 +75,7 @@
   (*FT_Hash_CompareFunc)( FT_Hashkey*  a,
                           FT_Hashkey*  b );
 
-  typedef void
-  (*FT_Hash_FreeFunc)( FT_Hashnode  hn,
-                       FT_Memory    memory );
 
-
   typedef struct  FT_HashRec_
   {
     FT_UInt  limit;
@@ -88,7 +84,6 @@
 
     FT_Hash_LookupFunc   lookup;
     FT_Hash_CompareFunc  compare;
-    FT_Hash_FreeFunc     free;
 
     FT_Hashnode*  table;
 
--- 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 );
     }