diff options
-rw-r--r-- | include/array.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/array.h b/include/array.h index e3ce3e8..0853c2d 100644 --- a/include/array.h +++ b/include/array.h @@ -45,7 +45,7 @@ _mlib_array_hdr(void *p, ptrdiff_t align) #define array_extend(p, xs, n) \ do { \ _mlib_arr_hdr_t *hdr = _mlib_array_hdr((p), alignof(typeof(*(p)))); \ - if (hdr->len + (n) <= hdr->cap) { \ + if (hdr->len + (n) >= hdr->cap) { \ (p) = array_resz((p), stdc_bit_ceil((size_t)hdr->len + (n))); \ hdr = _mlib_array_hdr((p), alignof(typeof(*(p)))); \ } \ |