From 8178a02c4048cef03952a075f87da91b6ec2ee96 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Wed, 27 Apr 2022 13:23:10 +0200 Subject: Finally FIXED cloning/to/from scheme to work properly. When using i_key_bind/i_val_bind, a .._clone() function *must* always be defined. Functions .._from and .._toraw is only required when i_keyraw/i_valraw type is defined. --- include/stc/cstack.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/stc/cstack.h') diff --git a/include/stc/cstack.h b/include/stc/cstack.h index f2412184..ee283cec 100644 --- a/include/stc/cstack.h +++ b/include/stc/cstack.h @@ -76,6 +76,14 @@ STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, size_t n) { return t ? (self->data = t, self->capacity = n) : 0; } +STC_INLINE _cx_value* +_cx_memb(_expand_uninitialized)(_cx_self *self, size_t n) { + size_t len = self->size; + if (!_cx_memb(_reserve)(self, len + n)) return NULL; + self->size += n; + return self->data + len; +} + STC_INLINE void _cx_memb(_shrink_to_fit)(_cx_self* self) { _cx_memb(_reserve)(self, self->size); } -- cgit v1.2.3