diff options
| -rw-r--r-- | include/stc/cdeq.h | 4 | ||||
| -rw-r--r-- | include/stc/clist.h | 2 | ||||
| -rw-r--r-- | include/stc/cpque.h | 2 | ||||
| -rw-r--r-- | include/stc/cstack.h | 2 | ||||
| -rw-r--r-- | include/stc/cvec.h | 2 |
5 files changed, 6 insertions, 6 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; diff --git a/include/stc/clist.h b/include/stc/clist.h index 7e47f7b7..b5939029 100644 --- a/include/stc/clist.h +++ b/include/stc/clist.h @@ -140,7 +140,7 @@ STC_INLINE void _cx_memb(_clear)(_cx_self* self) { _cx_memb(_drop)(self) STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, i_key value) { return _cx_memb(_push_back)(self, value); } STC_INLINE void _cx_memb(_pop_front)(_cx_self* self) - { _cx_memb(_erase_after_)(self, self->last); } + { assert(!_cx_memb(_empty)(self)); _cx_memb(_erase_after_)(self, self->last); } STC_INLINE _cx_value* _cx_memb(_front)(const _cx_self* self) { return &self->last->next->value; } STC_INLINE _cx_value* _cx_memb(_back)(const _cx_self* self) { return &self->last->value; } diff --git a/include/stc/cpque.h b/include/stc/cpque.h index 183390c4..532bf710 100644 --- a/include/stc/cpque.h +++ b/include/stc/cpque.h @@ -86,7 +86,7 @@ STC_INLINE const _cx_value* _cx_memb(_top)(const _cx_self* self) { return &self->data[0]; } STC_INLINE void _cx_memb(_pop)(_cx_self* self) - { _cx_memb(_erase_at)(self, 0); } + { assert(!_cx_memb(_empty)(self)); _cx_memb(_erase_at)(self, 0); } #if !defined _i_no_clone STC_API _cx_self _cx_memb(_clone)(_cx_self q); diff --git a/include/stc/cstack.h b/include/stc/cstack.h index c0611465..9126cdef 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -135,7 +135,7 @@ STC_INLINE _cx_value* _cx_memb(_push)(_cx_self* self, _cx_value val) { } STC_INLINE void _cx_memb(_pop)(_cx_self* self) - { _cx_value* p = &self->data[--self->_len]; i_keydrop(p); } + { assert(!_cx_memb(_empty)(self)); _cx_value* p = &self->data[--self->_len]; i_keydrop(p); } STC_INLINE const _cx_value* _cx_memb(_at)(const _cx_self* self, size_t idx) { assert(idx < self->_len); return self->data + idx; } diff --git a/include/stc/cvec.h b/include/stc/cvec.h index effcc1d1..4419f4a8 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -135,7 +135,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 + cvec_rep_(self)->size - 1; } STC_INLINE void _cx_memb(_pop)(_cx_self* self) - { _cx_value* p = &self->data[--cvec_rep_(self)->size]; i_keydrop(p); } + { assert(!_cx_memb(_empty)(self)); _cx_value* p = &self->data[--cvec_rep_(self)->size]; i_keydrop(p); } STC_INLINE _cx_value* _cx_memb(_push_back)(_cx_self* self, i_key value) { return _cx_memb(_push)(self, value); } STC_INLINE void _cx_memb(_pop_back)(_cx_self* self) { _cx_memb(_pop)(self); } |
