aboutsummaryrefslogtreecommitdiff
path: root/lib/cbit/vec.h
diff options
context:
space:
mode:
authorcomex2015-03-01 23:07:15 -0500
committercomex2015-03-01 23:07:15 -0500
commit7f24621bec0b0a5b3cab9ec2dfc68929a2d49d25 (patch)
tree7c227bfa4d8010e23b726eed8efb6bc51746e3f5 /lib/cbit/vec.h
parentseems to work (diff)
downloadsubstitute-7f24621bec0b0a5b3cab9ec2dfc68929a2d49d25.tar.gz
A number of critical fixes painstakingly discovered in the slowest way possible.
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; \
} \