MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / ht_create_at

Function ht_create_at

src/foundation/hash_table.c:93–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93static CBMHashTable *ht_create_at(cbm_mem_class_t cls, uint32_t initial_capacity, void *site) {
94 CBMHashTable *ht = (CBMHashTable *)cbm_calloc(cls, sizeof(*ht));
95 if (!ht)
96 return NULL;
97 ht->waste_site = site;
98 cbm_vt_init(&ht->vt, cls);
99 if (initial_capacity > 0) {
100 /* Reserve enough buckets for the requested entries. Verstable
101 * computes the minimum bucket count internally. */
102 if (!cbm_vt_reserve(&ht->vt, (size_t)initial_capacity)) {
103 cbm_vt_cleanup(&ht->vt);
104 cbm_free(cls, ht);
105 return NULL;
106 }
107 }
108 return ht;
109}
110
111void cbm_ht_free(CBMHashTable *ht) {
112 if (!ht)

Callers 2

cbm_ht_createFunction · 0.85
cbm_ht_create_inFunction · 0.85

Calls 2

cbm_callocFunction · 0.85
cbm_freeFunction · 0.85

Tested by

no test coverage detected