diff options
| author | Tyge Løvset <[email protected]> | 2022-12-29 00:28:50 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-12-29 00:28:50 +0100 |
| commit | 0761c13f316cc98ae7756f3527931aa86bed5016 (patch) | |
| tree | e90777558956fcf91d6b1c958e0c3a6fb0ab007f /include/stc/carc.h | |
| parent | d623c6c85071b9af5d607bb5d9aceceaea05220a (diff) | |
| download | STC-modified-0761c13f316cc98ae7756f3527931aa86bed5016.tar.gz STC-modified-0761c13f316cc98ae7756f3527931aa86bed5016.zip | |
Restructuring of some headers into include/algo folder. Some API changes *_replace*() functions have been renamed, and a few minor API changes.
Diffstat (limited to 'include/stc/carc.h')
| -rw-r--r-- | include/stc/carc.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h index 22453f1d..7f7789ab 100644 --- a/include/stc/carc.h +++ b/include/stc/carc.h @@ -72,7 +72,6 @@ int main() { #endif #define carc_NULL {NULL, NULL} -#define _cx_carc_rep struct _cx_memb(_rep_) #endif // CARC_H_INCLUDED #ifndef _i_prefix @@ -91,7 +90,7 @@ typedef i_keyraw _cx_raw; #if !c_option(c_is_forward) _cx_deftypes(_c_carc_types, _cx_self, i_key); #endif -_cx_carc_rep { catomic_long counter; i_key value; }; +struct _cx_memb(_rep_) { catomic_long counter; i_key value; }; STC_INLINE _cx_self _cx_memb(_init)(void) { return c_INIT(_cx_self){NULL, NULL}; } @@ -109,7 +108,7 @@ STC_INLINE _cx_self _cx_memb(_from_ptr)(_cx_value* p) { // c++: std::make_shared<_cx_value>(val) STC_INLINE _cx_self _cx_memb(_make)(_cx_value val) { _cx_self ptr; - _cx_carc_rep *rep = c_alloc(_cx_carc_rep); + struct _cx_memb(_rep_)* rep = c_alloc(struct _cx_memb(_rep_)); *(ptr.use_count = &rep->counter) = 1; *(ptr.get = &rep->value) = val; return ptr; @@ -127,7 +126,7 @@ STC_INLINE _cx_self _cx_memb(_move)(_cx_self* self) { 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(_cx_carc_rep, value)) + if ((char *)self->get != (char *)self->use_count + offsetof(struct _cx_memb(_rep_), value)) c_free(self->get); c_free((long*)self->use_count); } |
