[base] Make hash interface symmetric. Use `num' and `str' infixes everywhere. * src/base/fthash.c (ft_hash_init): Renamed to... (hash_init): ... This. (ft_hash_str_init, ft_hash_num_init): New functions. (ft_hash_free): Renamed to... (ft_hash_str_free): ... This. * include/freetype/internal/fthash.h: Updated. * src/bdf/bdflib.c, src/type1/t1load.c, src/type1/t1objs.c: 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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
diff --git a/ChangeLog b/ChangeLog
index fee0e5a..9d44af9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2015-12-22 Werner Lemberg <wl@gnu.org>
+
+ [base] Make hash interface symmetric.
+
+ Use `num' and `str' infixes everywhere.
+
+ * src/base/fthash.c (ft_hash_init): Renamed to...
+ (hash_init): ... This.
+ (ft_hash_str_init, ft_hash_num_init): New functions.
+ (ft_hash_free): Renamed to...
+ (ft_hash_str_free): ... This.
+
+ * include/freetype/internal/fthash.h: Updated.
+
+ * src/bdf/bdflib.c, src/type1/t1load.c, src/type1/t1objs.c: Updated.
+
2015-12-21 Werner Lemberg <wl@gnu.org>
[type1] Avoid shift of negative numbers (#46732).
diff --git a/include/freetype/internal/fthash.h b/include/freetype/internal/fthash.h
index 578d56b..2361019 100644
--- a/include/freetype/internal/fthash.h
+++ b/include/freetype/internal/fthash.h
@@ -93,13 +93,18 @@ FT_BEGIN_HEADER
FT_Error
- ft_hash_init( FT_Hash hash,
- FT_Bool is_num,
- FT_Memory memory );
+ ft_hash_str_init( FT_Hash hash,
+ FT_Memory memory );
+
+ FT_Error
+ ft_hash_num_init( FT_Hash hash,
+ FT_Memory memory );
void
- ft_hash_free( FT_Hash hash,
- FT_Memory memory );
+ ft_hash_str_free( FT_Hash hash,
+ FT_Memory memory );
+
+#define ft_hash_num_free ft_hash_str_free
FT_Error
ft_hash_str_insert( const char* key,
diff --git a/src/base/fthash.c b/src/base/fthash.c
index ff90f56..13c18bc 100644
--- a/src/base/fthash.c
+++ b/src/base/fthash.c
@@ -161,10 +161,10 @@
}
- FT_Error
- ft_hash_init( FT_Hash hash,
- FT_Bool is_num,
- FT_Memory memory )
+ static FT_Error
+ hash_init( FT_Hash hash,
+ FT_Bool is_num,
+ FT_Memory memory )
{
FT_UInt sz = INITIAL_HT_SIZE;
FT_Error error;
@@ -191,9 +191,25 @@
}
+ FT_Error
+ ft_hash_str_init( FT_Hash hash,
+ FT_Memory memory )
+ {
+ return hash_init( hash, 0, memory );
+ }
+
+
+ FT_Error
+ ft_hash_num_init( FT_Hash hash,
+ FT_Memory memory )
+ {
+ return hash_init( hash, 1, memory );
+ }
+
+
void
- ft_hash_free( FT_Hash hash,
- FT_Memory memory )
+ ft_hash_str_free( FT_Hash hash,
+ FT_Memory memory )
{
if ( hash )
{
@@ -210,6 +226,9 @@
}
+ /* `ft_hash_num_free' is the same as `ft_hash_str_free' */
+
+
static FT_Error
hash_insert( FT_Hashkey key,
size_t data,
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index cef52c4..136ad4f 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1938,7 +1938,7 @@
bdf_property_t* prop;
- error = ft_hash_init( &(font->proptbl), 0, memory );
+ error = ft_hash_str_init( &(font->proptbl), memory );
if ( error )
goto Exit;
for ( i = 0, prop = (bdf_property_t*)_bdf_properties;
@@ -1953,7 +1953,7 @@
if ( FT_ALLOC( p->font->internal, sizeof ( FT_HashRec ) ) )
goto Exit;
- error = ft_hash_init( (FT_Hash)p->font->internal, 0, memory );
+ error = ft_hash_str_init( (FT_Hash)p->font->internal, memory );
if ( error )
goto Exit;
p->font->spacing = p->opts->font_spacing;
@@ -2339,7 +2339,7 @@
/* Free up the internal hash table of property names. */
if ( font->internal )
{
- ft_hash_free( (FT_Hash)font->internal, memory );
+ ft_hash_str_free( (FT_Hash)font->internal, memory );
FT_FREE( font->internal );
}
@@ -2384,7 +2384,7 @@
FT_FREE( font->overflow.glyphs );
/* bdf_cleanup */
- ft_hash_free( &(font->proptbl), memory );
+ ft_hash_str_free( &(font->proptbl), memory );
/* Free up the user defined properties. */
for ( prop = font->user_props, i = 0;
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 4cb6ef0..1a56980 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1462,7 +1462,7 @@
if ( FT_NEW( hash ) )
goto Fail;
- error = ft_hash_init( hash, 1, memory );
+ error = ft_hash_num_init( hash, memory );
if ( error )
goto Fail;
}
@@ -2163,7 +2163,7 @@
T1_Release_Table( &loader->subrs );
/* finalize hash */
- ft_hash_free( loader->subrs_hash, memory );
+ ft_hash_num_free( loader->subrs_hash, memory );
FT_FREE( loader->subrs_hash );
/* finalize parser */
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 7c92256..34bfaea 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -247,7 +247,7 @@
FT_FREE( type1->subrs );
FT_FREE( type1->subrs_len );
- ft_hash_free( type1->subrs_hash, memory );
+ ft_hash_num_free( type1->subrs_hash, memory );
FT_FREE( type1->subrs_hash );
FT_FREE( type1->subrs_block );