diff options
| author | Tyge Løvset <[email protected]> | 2022-09-23 12:32:02 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-09-23 12:32:02 +0200 |
| commit | 0ec40a5819a619b6b2777f24c555a8953e99ea9b (patch) | |
| tree | 71849156f92044f14c11ebf14716afde8a46b7e3 /include/stc/cdeq.h | |
| parent | 1d7da47d207c2ce569367cac66f56e22344bab1c (diff) | |
| download | STC-modified-0ec40a5819a619b6b2777f24c555a8953e99ea9b.tar.gz STC-modified-0ec40a5819a619b6b2777f24c555a8953e99ea9b.zip | |
Added assert() checks in pop-functions.
Diffstat (limited to 'include/stc/cdeq.h')
| -rw-r--r-- | include/stc/cdeq.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h index e73d13b7..423464ac 100644 --- a/include/stc/cdeq.h +++ b/include/stc/cdeq.h @@ -97,7 +97,7 @@ STC_INLINE _cx_value* _cx_memb(_front)(const _cx_self* self) { return self->da STC_INLINE _cx_value* _cx_memb(_back)(const _cx_self* self) { return self->data + cdeq_rep_(self)->size - 1; } STC_INLINE void _cx_memb(_pop_front)(_cx_self* self) // == _pop() when _i_queue - { i_keydrop(self->data); ++self->data; --cdeq_rep_(self)->size; } + { assert(!_cx_memb(_empty)(self)); i_keydrop(self->data); ++self->data; --cdeq_rep_(self)->size; } STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) { size_t n = cdeq_rep_(self)->size; @@ -118,7 +118,7 @@ STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, isize_t n) STC_INLINE size_t _cx_memb(_index)(const _cx_self* cx, _cx_iter it) { return it.ref - cx->data; } STC_INLINE void _cx_memb(_pop_back)(_cx_self* self) - { _cx_value* p = &self->data[--cdeq_rep_(self)->size]; i_keydrop(p); } + { assert(!_cx_memb(_empty)(self)); _cx_value* p = &self->data[--cdeq_rep_(self)->size]; i_keydrop(p); } STC_INLINE const _cx_value* _cx_memb(_at)(const _cx_self* self, const size_t idx) { assert(idx < cdeq_rep_(self)->size); return self->data + idx; |
