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

@@ -194,6 +194,7 @@ void HT_Remove (HashTable* T, void* Entry)
if (*Q == N) {
/* Found - remove it */
*Q = N->Next;
--T->Count;
break;
}
/* Next node */
@@ -235,6 +236,7 @@ void HT_Walk (HashTable* T, int (*F) (void* Entry, void* Data), void* Data)
if (F (*Cur, Data)) {
/* Delete the node from the chain */
*Cur = Next;
--T->Count;
} else {
/* Next node in chain */
Cur = &(*Cur)->Next;