aboutsummaryrefslogtreecommitdiff
path: root/src/vec.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-03-14 21:08:01 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2025-03-14 21:08:01 +0200
commitf5c729ea59d227a507f83bd94d07f4366b46d72b (patch)
tree70d1f242100cea09acd38a71ff8c821836117cfd /src/vec.h
parent57f6b41047e95374701ee276248f0f8615168450 (diff)
downloadejit-f5c729ea59d227a507f83bd94d07f4366b46d72b.tar.gz
ejit-f5c729ea59d227a507f83bd94d07f4366b46d72b.zip
start supporting 32bit arches
Diffstat (limited to 'src/vec.h')
-rw-r--r--src/vec.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vec.h b/src/vec.h
index f982bac..f5a6fd9 100644
--- a/src/vec.h
+++ b/src/vec.h
@@ -73,6 +73,7 @@ static inline void VEC(append)(struct VEC_STRUCT *v, VEC_TYPE n)
if (v->n >= v->s) {
v->s *= 2;
v->buf = realloc(v->buf, v->s * sizeof(VEC_TYPE));
+ assert(v->buf);
}
v->buf[v->n - 1] = n;
@@ -99,6 +100,9 @@ static inline void VEC(reserve)(struct VEC_STRUCT *v, size_t n)
return;
v->n = n;
+ if (v->s >= v->n)
+ return;
+
while (v->s < v->n)
v->s *= 2;