1
mirror of https://github.com/mpv-player/mpv synced 2024-08-24 07:21:49 +02:00

Fix MP_TARRAY_GROW macro

This macro is supposed to make sure an array has enough memory allocated
for a given number of elements. Unfortunately, a condition was inverted
(I... what???). It only allocated if there was still enough memory left,
or only one additional element had to be allocated.

Since this macro was only used by MP_TARRAY_APPEND, this case was never
actually triggered. It's still utter non-sense.
This commit is contained in:
wm4 2012-09-23 22:10:40 +02:00
parent 0de86f5bf3
commit df2b0f9948

View File

@ -41,7 +41,7 @@
do { \
size_t nextidx_ = (nextidx); \
size_t nelems_ = MP_TALLOC_ELEMS(p); \
if (nextidx_ <= nelems_) \
if (nextidx_ >= nelems_) \
p = talloc_realloc_size((ctx), p, \
(nextidx_ + 1) * sizeof((p)[0]) * 2);\
} while (0)