Hide HashTable_SetupForStringData implementation

This commit is contained in:
Armin Novak 2021-06-09 11:17:25 +02:00 committed by akallabeth
parent 30776358bb
commit b9a9f50dd2
2 changed files with 27 additions and 25 deletions

View File

@ -327,31 +327,7 @@ extern "C"
WINPR_API BOOL HashTable_SetHashFunction(wHashTable* table, HASH_TABLE_HASH_FN fn); WINPR_API BOOL HashTable_SetHashFunction(wHashTable* table, HASH_TABLE_HASH_FN fn);
/* Utility function to setup hash table for strings */ /* Utility function to setup hash table for strings */
static INLINE BOOL HashTable_SetupForStringData(wHashTable* table, BOOL stringValues) WINPR_API BOOL HashTable_SetupForStringData(wHashTable* table, BOOL stringValues);
{
wObject* obj;
if (!HashTable_SetHashFunction(table, HashTable_StringHash))
return FALSE;
obj = HashTable_KeyObject(table);
if (!obj)
return FALSE;
obj->fnObjectEquals = HashTable_StringCompare;
obj->fnObjectNew = HashTable_StringClone;
obj->fnObjectFree = HashTable_StringFree;
if (stringValues)
{
obj = HashTable_ValueObject(table);
if (!obj)
return FALSE;
obj->fnObjectEquals = HashTable_StringCompare;
obj->fnObjectNew = HashTable_StringClone;
obj->fnObjectFree = HashTable_StringFree;
}
return TRUE;
}
/* BufferPool */ /* BufferPool */

View File

@ -815,3 +815,29 @@ BOOL HashTable_SetHashFunction(wHashTable* table, HASH_TABLE_HASH_FN fn)
table->hash = fn; table->hash = fn;
return TRUE; return TRUE;
} }
BOOL HashTable_SetupForStringData(wHashTable* table, BOOL stringValues)
{
wObject* obj;
if (!HashTable_SetHashFunction(table, HashTable_StringHash))
return FALSE;
obj = HashTable_KeyObject(table);
if (!obj)
return FALSE;
obj->fnObjectEquals = HashTable_StringCompare;
obj->fnObjectNew = HashTable_StringClone;
obj->fnObjectFree = HashTable_StringFree;
if (stringValues)
{
obj = HashTable_ValueObject(table);
if (!obj)
return FALSE;
obj->fnObjectEquals = HashTable_StringCompare;
obj->fnObjectNew = HashTable_StringClone;
obj->fnObjectFree = HashTable_StringFree;
}
return TRUE;
}