summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cstack.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-05-18 15:39:48 +0200
committerTyge Løvset <[email protected]>2023-05-18 15:48:45 +0200
commitc54da07eb171455ad182d61a1fb5c4e4520aebbb (patch)
treee14e7796f075a37d8dd05ff22bf8bfe4d10b6eee /include/stc/cstack.h
parent50a16934dde8e65bbcf628d6342c1649f7e09365 (diff)
downloadSTC-modified-c54da07eb171455ad182d61a1fb5c4e4520aebbb.tar.gz
STC-modified-c54da07eb171455ad182d61a1fb5c4e4520aebbb.zip
Fixing find_in() in cdeq, and add support c_eraseremove_if() for cqueue and cdeq.
Diffstat (limited to 'include/stc/cstack.h')
-rw-r--r--include/stc/cstack.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index 87ef9405..84bdb41b 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -80,6 +80,7 @@ STC_INLINE void _cx_memb(_drop)(_cx_self* self) {
i_free(self->data);
#endif
}
+
STC_INLINE intptr_t _cx_memb(_size)(const _cx_self* self)
{ return self->_len; }
@@ -187,4 +188,10 @@ STC_INLINE void _cx_memb(_next)(_cx_iter* it)
STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t n)
{ if ((it.ref += n) >= it.end) it.ref = NULL ; return it; }
+STC_INLINE intptr_t _cx_memb(_index)(const _cx_self* self, _cx_iter it)
+ { return (it.ref - self->data); }
+
+STC_INLINE void _cx_memb(_adjust_end_)(_cx_self* self, intptr_t n)
+ { self->_len += n; }
+
#include "priv/template2.h"