diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/cstack.h | 2 | ||||
| -rw-r--r-- | include/stc/cvec.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/stc/cstack.h b/include/stc/cstack.h index f8640ed1..8fb176e1 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -103,7 +103,7 @@ STC_INLINE bool _cx_MEMB(_reserve)(_cx_Self* self, intptr_t n) { STC_INLINE _cx_value* _cx_MEMB(_append_uninit)(_cx_Self *self, intptr_t n) { intptr_t len = self->_len; - if (!_cx_MEMB(_reserve)(self, len + n)) return NULL; + if (!_cx_MEMB(_reserve)(self, len*3/2 + n)) return NULL; self->_len += n; return self->data + len; } diff --git a/include/stc/cvec.h b/include/stc/cvec.h index d08e382f..774f0582 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -316,7 +316,7 @@ _cx_MEMB(_resize)(_cx_Self* self, const intptr_t len, i_key null) { STC_DEF _cx_value* _cx_MEMB(_push)(_cx_Self* self, i_key value) { if (self->_len == self->_cap) - if (!_cx_MEMB(_reserve)(self, self->_len*3/2 + 4)) + if (!_cx_MEMB(_reserve)(self, self->_len*2 + 4)) return NULL; _cx_value *v = self->data + self->_len++; *v = value; |
