[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 7ce6c43: [base] Make hash interface symmetric.
From: |
Werner LEMBERG |
Subject: |
[freetype2] master 7ce6c43: [base] Make hash interface symmetric. |
Date: |
Tue, 22 Dec 2015 04:40:16 +0000 |
branch: master
commit 7ce6c43c3e7cc78d1f698740012afb38a3985c0f
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>
[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.
---
ChangeLog | 16 ++++++++++++++++
include/freetype/internal/fthash.h | 15 ++++++++++-----
src/base/fthash.c | 31 +++++++++++++++++++++++++------
src/bdf/bdflib.c | 8 ++++----
src/type1/t1load.c | 4 ++--
src/type1/t1objs.c | 2 +-
6 files changed, 58 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fee0e5a..9d44af9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2015-12-22 Werner Lemberg <address@hidden>
+
+ [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 <address@hidden>
[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 );
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 7ce6c43: [base] Make hash interface symmetric.,
Werner LEMBERG <=