Fix errors in tracking the number of items in the table. Added function

HT_GetCount to retrieve the number of items.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5248 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-08-21 16:56:40 +00:00
parent ae98f4bcd8
commit d0d550be66
2 changed files with 12 additions and 0 deletions

View File

@@ -139,6 +139,16 @@ INLINE HashTable* NewHashTable (unsigned Slots, const HashFunctions* Func)
void FreeHashTable (HashTable* T);
/* Free a hash table. Note: This will not free the entries in the table! */
#if defined(HAVE_INLINE)
INLINE unsigned HT_GetCount (const HashTable* T)
/* Return the number of items in the table. */
{
return T->Count;
}
#else
#define HT_GetCount(T) ((T)->Count)
#endif
HashNode* HT_FindHash (const HashTable* T, const void* Key, unsigned Hash);
/* Find the node with the given key. Differs from HT_Find in that the hash
* for the key is precalculated and passed to the function.