mirror of
git://git.sv.nongnu.org/freetype/freetype2.git
synced 2026-01-19 04:52:09 +00:00
[base] Add no-overwrite hash insert functions.
* src/base/fthash.c (ft_hash_num_insert_no_overwrite, ft_hash_str_insert_no_overwrite): New functions. * include/freetype/internal/fthash.h: Updated.
This commit is contained in:
@@ -117,6 +117,18 @@ FT_BEGIN_HEADER
|
||||
FT_Hash hash,
|
||||
FT_Memory memory );
|
||||
|
||||
FT_Error
|
||||
ft_hash_str_insert_no_overwrite( const char* key,
|
||||
size_t data,
|
||||
FT_Hash hash,
|
||||
FT_Memory memory );
|
||||
|
||||
FT_Error
|
||||
ft_hash_num_insert_no_overwrite( FT_Int num,
|
||||
size_t data,
|
||||
FT_Hash hash,
|
||||
FT_Memory memory );
|
||||
|
||||
size_t*
|
||||
ft_hash_str_lookup( const char* key,
|
||||
FT_Hash hash );
|
||||
|
||||
@@ -233,7 +233,8 @@
|
||||
hash_insert( FT_Hashkey key,
|
||||
size_t data,
|
||||
FT_Hash hash,
|
||||
FT_Memory memory )
|
||||
FT_Memory memory,
|
||||
FT_Bool overwrite )
|
||||
{
|
||||
FT_Hashnode nn;
|
||||
FT_Hashnode* bp = hash_bucket( key, hash );
|
||||
@@ -259,7 +260,7 @@
|
||||
|
||||
hash->used++;
|
||||
}
|
||||
else
|
||||
else if ( overwrite )
|
||||
nn->data = data;
|
||||
|
||||
Exit:
|
||||
@@ -278,7 +279,7 @@
|
||||
|
||||
hk.str = key;
|
||||
|
||||
return hash_insert( hk, data, hash, memory );
|
||||
return hash_insert( hk, data, hash, memory, TRUE );
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +294,37 @@
|
||||
|
||||
hk.num = num;
|
||||
|
||||
return hash_insert( hk, data, hash, memory );
|
||||
return hash_insert( hk, data, hash, memory, TRUE );
|
||||
}
|
||||
|
||||
|
||||
FT_Error
|
||||
ft_hash_str_insert_no_overwrite( const char* key,
|
||||
size_t data,
|
||||
FT_Hash hash,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_Hashkey hk;
|
||||
|
||||
|
||||
hk.str = key;
|
||||
|
||||
return hash_insert( hk, data, hash, memory, FALSE );
|
||||
}
|
||||
|
||||
|
||||
FT_Error
|
||||
ft_hash_num_insert_no_overwrite( FT_Int num,
|
||||
size_t data,
|
||||
FT_Hash hash,
|
||||
FT_Memory memory )
|
||||
{
|
||||
FT_Hashkey hk;
|
||||
|
||||
|
||||
hk.num = num;
|
||||
|
||||
return hash_insert( hk, data, hash, memory, FALSE );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user