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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user