From 0ec40a5819a619b6b2777f24c555a8953e99ea9b Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Fri, 23 Sep 2022 12:32:02 +0200 Subject: Added assert() checks in pop-functions. --- include/stc/cvec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/stc/cvec.h') 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); } -- cgit v1.2.3