summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cstack.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-04-27 13:23:10 +0200
committerTyge Løvset <[email protected]>2022-04-27 13:23:10 +0200
commit8178a02c4048cef03952a075f87da91b6ec2ee96 (patch)
treebc5b9a2fc2c64ae5a1b3eb665e828e4246707247 /include/stc/cstack.h
parente6738b3da5cbd7703cf3fbd905b3fdac19d0ae24 (diff)
downloadSTC-modified-8178a02c4048cef03952a075f87da91b6ec2ee96.tar.gz
STC-modified-8178a02c4048cef03952a075f87da91b6ec2ee96.zip
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.
Diffstat (limited to 'include/stc/cstack.h')
-rw-r--r--include/stc/cstack.h8
1 files changed, 8 insertions, 0 deletions
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); }