From f5c729ea59d227a507f83bd94d07f4366b46d72b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 14 Mar 2025 21:08:01 +0200 Subject: start supporting 32bit arches --- src/vec.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/vec.h') 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; -- cgit v1.2.3