working on unload and added getsize to hashtable
This commit is contained in:
parent
3fbccd9752
commit
ba467ac6b6
3 changed files with 53 additions and 1 deletions
|
|
@ -406,6 +406,25 @@ void *ARC_Hashtable_Get(ARC_Hashtable *hashtable, void *key){
|
|||
return NULL;
|
||||
}
|
||||
|
||||
uint32_t ARC_Hashtable_GetSize(ARC_Hashtable *hashtable){
|
||||
uint32_t size = 0;
|
||||
|
||||
//loop through the vector and add iterate the size when the value is not null
|
||||
for(uint32_t index = 0; index < hashtable->currentCapacity; index++){
|
||||
//get the current node
|
||||
ARC_HashtableNode node = hashtable->nodes[index];
|
||||
|
||||
//skip past NULL keys
|
||||
if(node.key == NULL){
|
||||
continue;
|
||||
}
|
||||
|
||||
size++;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
void ARC_Hashtable_RunIteration(ARC_Hashtable *hashtable, ARC_Hashtable_IteratorFn iteratorFn, void *userData){
|
||||
//pass each non NULL nodes into an iteratorFn callback
|
||||
for(uint32_t index = 0; index < hashtable->currentCapacity; index++){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue