| 109 | } |
| 110 | |
| 111 | void cbm_ht_free(CBMHashTable *ht) { |
| 112 | if (!ht) |
| 113 | return; |
| 114 | cbm_mem_class_t cls = ht->vt.ctx; |
| 115 | #if defined(CBM_MEMWASTE) && CBM_MEMWASTE |
| 116 | if (cbm_memev_enabled()) { |
| 117 | cbm_memev_container(CBM_WORK_CT_HASH_TABLE, ht->waste_site, |
| 118 | (uint64_t)cbm_vt_bucket_count(&ht->vt) * HT_SLOT_BYTES, |
| 119 | (uint64_t)cbm_vt_size(&ht->vt) * HT_SLOT_BYTES, ht->waste_growths); |
| 120 | } |
| 121 | #endif |
| 122 | cbm_vt_cleanup(&ht->vt); |
| 123 | cbm_free(cls, ht); |
| 124 | } |
| 125 | |
| 126 | void *cbm_ht_set(CBMHashTable *ht, const char *key, void *value) { |
| 127 | if (!ht || !key) |