diff options
| author | Tyge Løvset <[email protected]> | 2023-06-14 13:24:29 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-06-14 13:24:29 +0200 |
| commit | 3f919a3b38a88e1c96399cd6096dec16060802a1 (patch) | |
| tree | 8c071e33522d31cd7c90834423760da514fc7f46 /include/stc/cstack.h | |
| parent | c51bdc8d8aeac63c0af955f81593ef0be326a7e0 (diff) | |
| download | STC-modified-3f919a3b38a88e1c96399cd6096dec16060802a1.tar.gz STC-modified-3f919a3b38a88e1c96399cd6096dec16060802a1.zip | |
Fixed a bug in cco_await_on(), and added _pull() function to random access containers (moves element out of container, ie no drop).
Diffstat (limited to 'include/stc/cstack.h')
| -rw-r--r-- | include/stc/cstack.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/stc/cstack.h b/include/stc/cstack.h index fb4eae4b..5f0ffe2b 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -129,7 +129,10 @@ STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, _cx_value val) { } STC_INLINE void _cx_memb(_pop)(_cx_self* self) - { assert(!_cx_memb(_empty)(self)); _cx_value* p = &self->data[--self->_len]; i_keydrop(p); } + { assert(self->_len); _cx_value* p = &self->data[--self->_len]; i_keydrop(p); } + +STC_INLINE _cx_value _cx_memb(_pull)(_cx_self* self) + { assert(self->_len); return self->data[--self->_len]; } STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, intptr_t n) { while (n--) _cx_memb(_push)(self, i_keyfrom(*raw++)); } |
