diff options
| author | Tyge Løvset <[email protected]> | 2023-02-07 12:30:39 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-07 12:30:39 +0100 |
| commit | ca54204557669fb54f43959594ee92109fcc75b6 (patch) | |
| tree | 9880ad3d7e3dca7e309e0b96f5c88ebbb0552853 /include/stc/cmap.h | |
| parent | 3cb564e7274b7749531742fa7c50fd928fdbe2d9 (diff) | |
| download | STC-modified-ca54204557669fb54f43959594ee92109fcc75b6.tar.gz STC-modified-ca54204557669fb54f43959594ee92109fcc75b6.zip | |
Added custom allocator per container type.
Diffstat (limited to 'include/stc/cmap.h')
| -rw-r--r-- | include/stc/cmap.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/stc/cmap.h b/include/stc/cmap.h index f5547125..f3c82469 100644 --- a/include/stc/cmap.h +++ b/include/stc/cmap.h @@ -318,8 +318,8 @@ STC_INLINE void _cx_memb(_wipe_)(_cx_self* self) { STC_DEF void _cx_memb(_drop)(_cx_self* self) { _cx_memb(_wipe_)(self); - c_free(self->_hashx); - c_free((void *) self->table); + i_free(self->_hashx); + i_free((void *) self->table); } STC_DEF void _cx_memb(_clear)(_cx_self* self) { @@ -395,11 +395,11 @@ _cx_memb(_insert_entry_)(_cx_self* self, _cx_rawkey rkey) { STC_DEF _cx_self _cx_memb(_clone)(_cx_self m) { if (m.table) { - _cx_value *t = (_cx_value *)c_malloc(c_sizeof(_cx_value)*m.bucket_count), + _cx_value *t = (_cx_value *)i_malloc(c_sizeof(_cx_value)*m.bucket_count), *dst = t, *m_end = m.table + m.bucket_count; - uint8_t *h = (uint8_t *)c_memcpy(c_malloc(m.bucket_count + 1), m._hashx, m.bucket_count + 1); + uint8_t *h = (uint8_t *)c_memcpy(i_malloc(m.bucket_count + 1), m._hashx, m.bucket_count + 1); if (!(t && h)) - { c_free(t), c_free(h), t = 0, h = 0, m.bucket_count = 0; } + { i_free(t), i_free(h), t = 0, h = 0, m.bucket_count = 0; } else for (; m.table != m_end; ++m.table, ++m._hashx, ++dst) if (*m._hashx) @@ -422,8 +422,8 @@ _cx_memb(_reserve)(_cx_self* self, const int64_t newcap) { _nbuckets |= 1; #endif _cx_self m = { - (_cx_value *)c_malloc(c_sizeof(_cx_value)*_nbuckets), - (uint8_t *)c_calloc(_nbuckets + 1, 1), + (_cx_value *)i_malloc(c_sizeof(_cx_value)*_nbuckets), + (uint8_t *)i_calloc(_nbuckets + 1, 1), self->size, _nbuckets, }; bool ok = m.table && m._hashx; @@ -439,8 +439,8 @@ _cx_memb(_reserve)(_cx_self* self, const int64_t newcap) { } c_swap(_cx_self, self, &m); } - c_free(m._hashx); - c_free(m.table); + i_free(m._hashx); + i_free(m.table); return ok; } |
