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/carc.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/carc.h')
| -rw-r--r-- | include/stc/carc.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h index 5bf4ebc2..82f8835d 100644 --- a/include/stc/carc.h +++ b/include/stc/carc.h @@ -101,14 +101,14 @@ STC_INLINE long _cx_memb(_use_count)(const _cx_self* self) STC_INLINE _cx_self _cx_memb(_from_ptr)(_cx_value* p) { _cx_self ptr = {p}; if (p) - *(ptr.use_count = c_ALLOC(catomic_long)) = 1; + *(ptr.use_count = _i_alloc(catomic_long)) = 1; return ptr; } // c++: std::make_shared<_cx_value>(val) STC_INLINE _cx_self _cx_memb(_make)(_cx_value val) { _cx_self ptr; - struct _cx_memb(_rep_)* rep = c_ALLOC(struct _cx_memb(_rep_)); + struct _cx_memb(_rep_)* rep = _i_alloc(struct _cx_memb(_rep_)); *(ptr.use_count = &rep->counter) = 1; *(ptr.get = &rep->value) = val; return ptr; @@ -127,8 +127,8 @@ STC_INLINE void _cx_memb(_drop)(_cx_self* self) { if (self->use_count && _i_atomic_dec_and_test(self->use_count)) { i_keydrop(self->get); if ((char *)self->get != (char *)self->use_count + offsetof(struct _cx_memb(_rep_), value)) - c_free(self->get); - c_free((long*)self->use_count); + i_free(self->get); + i_free((long*)self->use_count); } } |
