wipe elements overwritten by a splice
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
This commit is contained in:
parent
25fc879582
commit
dc6373488f
|
@ -61,6 +61,9 @@
|
||||||
assert (pos <= arr->len && pos + len < arr->len); \
|
assert (pos <= arr->len && pos + len < arr->len); \
|
||||||
if (len != count) { \
|
if (len != count) { \
|
||||||
pfx##_array_grow(arr, arr->len + count - len); \
|
pfx##_array_grow(arr, arr->len + count - len); \
|
||||||
|
for (int i = pos; i < pos + len; i++) { \
|
||||||
|
dtor(&arr->tab[i]); \
|
||||||
|
} \
|
||||||
memmove(arr->tab + pos + count, arr->tab + pos + len, \
|
memmove(arr->tab + pos + count, arr->tab + pos + len, \
|
||||||
arr->len - pos - len); \
|
arr->len - pos - len); \
|
||||||
arr->len += count - len; \
|
arr->len += count - len; \
|
||||||
|
|
Loading…
Reference in New Issue