src/libs/hash_lib.c
void hash_table_scan(Hash_Table* table, void (*scan_func)(void*, void*),
                     void*       arg) {
  int               count = 0;
  Hash_Table_Entry* temp;
  int               ii;

  ASSERT(0, scan_func);

  if(table->count == 0)
    return;

  for(ii = 0; ii < table->buckets; ii++) {
    temp = table->entries[ii];
    while(temp) {
      count++;
      scan_func(temp->data, arg);
      temp = temp->next;
    }
  }
  ASSERT(0, count == table->count);
}
/**************************************************************************************/
// hash_table_scan: scans all of the nodes in the hash table and runs
// the scan_fanc on them
scans all of the nodes in the hash table and runs
the scan_fanc on them
scans all of the nodes in the hash table and runs the scan_fanc on them
void hash_table_scan(Hash_Table* table, void (*scan_func)(void*, void*),
                     void*       arg) {
  int               count = 0;
  Hash_Table_Entry* temp;
  int               ii;
  ASSERT(0, scan_func);
  if(table->count == 0)
    return;
  for(ii = 0; ii < table->buckets; ii++) {
    temp = table->entries[ii];
    while(temp) {
      count++;
      scan_func(temp->data, arg);
      temp = temp->next;
    }
  }
  ASSERT(0, count == table->count);
}
void hash_table_scan ( Hash_Table * table , void ( * scan_func ) ( void * , void * ) , void * arg ) { int count = 0 ; Hash_Table_Entry * temp ; int ii ; ASSERT ( 0 , scan_func ) ; if ( table -> count == 0 ) return ; for ( ii = 0 ; ii < table -> buckets ; ii ++ ) { temp = table -> entries [ ii ] ; while ( temp ) { count ++ ; scan_func ( temp -> data , arg ) ; temp = temp -> next ; } } ASSERT ( 0 , count == table -> count ) ; }
hash_table_scan: scans all of the nodes in the hash table and runs
the scan_fanc on them
hash_table_scan : scans all of the nodes in the hash table and runs the scan_fanc on them