aboutsummaryrefslogtreecommitdiff
path: root/lib/cbit/vec.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cbit/vec.h')
-rw-r--r--lib/cbit/vec.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/cbit/vec.h b/lib/cbit/vec.h
index 2889ac1..eddee6a 100644
--- a/lib/cbit/vec.h
+++ b/lib/cbit/vec.h
@@ -73,8 +73,8 @@ void vec_realloc_internal_as_necessary(struct vec_internal *vi,
VEC_TY(name) vec_pop_##name(struct vec_##name *v) { \
size_t i = v->length - 1; \
VEC_TY(name) ret = v->els[i]; \
- if (i - 1 < v->capacity / 3) \
- vec_realloc_internal_as_necessary(&v->vi, i - 1, sizeof(v->els[0])); \
+ if (v->els != v->storage && i < v->capacity / 3) \
+ vec_realloc_internal_as_necessary(&v->vi, i, sizeof(v->els[0])); \
v->length = i; \
return ret; \
} \