summaryrefslogtreecommitdiffhomepage
path: root/include/stc/carc.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-20 14:44:25 +0100
committerTyge Løvset <[email protected]>2023-02-20 14:44:25 +0100
commita8fc8ac4e8c1481300e0d46bbd376f32ebeb4635 (patch)
tree68dad18a7cf235916b5a1a2257bb80e69bb5d23e /include/stc/carc.h
parent0e3d07dbd991c1f1a691b24655c37ddab660a9d9 (diff)
downloadSTC-modified-a8fc8ac4e8c1481300e0d46bbd376f32ebeb4635.tar.gz
STC-modified-a8fc8ac4e8c1481300e0d46bbd376f32ebeb4635.zip
Added c_eraseremove_if() for cvec, cdeq, cstack, cqueue in ccommon.h. Some cleanup.
Diffstat (limited to 'include/stc/carc.h')
-rw-r--r--include/stc/carc.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h
index d606ac6e..02bbaf52 100644
--- a/include/stc/carc.h
+++ b/include/stc/carc.h
@@ -160,6 +160,12 @@ STC_INLINE _cx_self _cx_memb(_clone)(_cx_self ptr) {
return ptr;
}
+// take ownership of unowned
+STC_INLINE void _cx_memb(_take)(_cx_self* self, _cx_self unowned) {
+ _cx_memb(_drop)(self);
+ *self = unowned;
+}
+// share ownership with ptr
STC_INLINE void _cx_memb(_assign)(_cx_self* self, _cx_self ptr) {
if (ptr.use_count)
_i_atomic_inc(ptr.use_count);
@@ -167,12 +173,6 @@ STC_INLINE void _cx_memb(_assign)(_cx_self* self, _cx_self ptr) {
*self = ptr;
}
-STC_INLINE void _cx_memb(_take)(_cx_self* self, _cx_self unowned) {
- if (self->get != unowned.get)
- _cx_memb(_drop)(self);
- *self = unowned;
-}
-
#ifndef i_no_cmp
STC_INLINE int _cx_memb(_raw_cmp)(const _cx_raw* rx, const _cx_raw* ry)
{ return i_cmp(rx, ry); }