aboutsummaryrefslogtreecommitdiff
path: root/src/vec.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vec.h')
-rw-r--r--src/vec.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vec.h b/src/vec.h
index 90558ac..f982bac 100644
--- a/src/vec.h
+++ b/src/vec.h
@@ -99,10 +99,10 @@ static inline void VEC(reserve)(struct VEC_STRUCT *v, size_t n)
return;
v->n = n;
- if (v->s < v->n) {
+ while (v->s < v->n)
v->s *= 2;
- v->buf = realloc(v->buf, v->s * sizeof(VEC_TYPE));
- }
+
+ v->buf = realloc(v->buf, v->s * sizeof(VEC_TYPE));
}
static inline void VEC(shrink)(struct VEC_STRUCT *v, size_t n)