Readded ArrayList_Add and HashTable_Add as deprecated

This commit is contained in:
Armin Novak 2021-06-09 11:14:57 +02:00 committed by akallabeth
parent a96c192977
commit 30776358bb
3 changed files with 16 additions and 0 deletions

View File

@ -124,6 +124,7 @@ extern "C"
WINPR_API void ArrayList_Clear(wArrayList* arrayList);
WINPR_API BOOL ArrayList_Contains(wArrayList* arrayList, const void* obj);
WINPR_API WINPR_DEPRECATED(int ArrayList_Add(wArrayList* arrayList, const void* obj));
WINPR_API BOOL ArrayList_Append(wArrayList* arrayList, const void* obj);
WINPR_API BOOL ArrayList_Insert(wArrayList* arrayList, size_t index, const void* obj);
@ -296,6 +297,8 @@ extern "C"
typedef BOOL (*HASH_TABLE_FOREACH_FN)(const void* key, void* value, void* arg);
WINPR_API size_t HashTable_Count(wHashTable* table);
WINPR_API WINPR_DEPRECATED(int HashTable_Add(wHashTable* table, const void* key,
const void* value));
WINPR_API BOOL HashTable_Insert(wHashTable* table, const void* key, const void* value);
WINPR_API BOOL HashTable_Remove(wHashTable* table, const void* key);
WINPR_API void HashTable_Clear(wHashTable* table);

View File

@ -265,6 +265,13 @@ BOOL ArrayList_Contains(wArrayList* arrayList, const void* obj)
return rc;
}
int ArrayList_Add(wArrayList* arrayList, const void* obj)
{
if (!ArrayList_Append(arrayList, obj))
return -1;
return ArrayList_Count(arrayList) - 1;
}
/**
* Adds an object to the end of the ArrayList.
*/

View File

@ -273,6 +273,12 @@ size_t HashTable_Count(wHashTable* table)
/**
* Adds an element with the specified key and value into the HashTable.
*/
int HashTable_Add(wHashTable* table, const void* key, const void* value)
{
if (!HashTable_Insert(table, key, value))
return -1;
return 0;
}
BOOL HashTable_Insert(wHashTable* table, const void* key, const void* value)
{