static void object_remove_links(Object *obj) { link_t **lks = NULL; // Array<link_t*> size_t lks_size = 0; locker_start1(obj); if (hashtable_size(obj->links) > 0) { lks = xmalloc(sizeof(link_t *) * hashtable_size(obj->links), "object_remove_links"); HASHTABLE_FOREACH(entry, obj->links, { lks[lks_size++] = entry->value; })
void print_hashtable(Hashtable* table) { if (table == NULL || table->table == NULL) { puts("NULL table"); return; } size_t i; printf("size: %d, count: %d\n", hashtable_size(table), hashtable_elemts_count(table)); for (i = 0; i < table->size; ++i) { HashLnkLstNode* p = table->table[i]; printf("%4d: %x", i, (unsigned int)p); if (p == NULL || p->next == NULL) { puts(""); } else { p = p->next; while(p != NULL) { printf(" ->%x", (unsigned int)p); p = p->next; } puts(""); } } }
static void object_del(Object *obj) { locker_start1(&obj->lock); object_set_collector(obj, NULL); assert(hashtable_size(obj->links) == 0); // make *sure* there are no links hashtable_destroy(obj->links); obj->magic = 0; if (obj->dtor != NULL) { obj->dtor(obj->data); } locker_end(); free(obj); // free the memory acid_collect_count++; }
static void setup_replacement_objects( obj rplc_tbl ) { hi_init_queue_n( &rplc_queue, hashtable_size(rplc_tbl) ); hashtable_foreach( rplc_tbl, (void *)&rplc_queue, init_rplc ); }