Skip to content
Snippets Groups Projects
Commit 48bb93b4 authored by zuul's avatar zuul Committed by Gerrit Code Review
Browse files

Merge "vector: After remove element recheck index"

parents 33997ef6 17031f12
No related branches found
No related tags found
No related merge requests found
......@@ -367,11 +367,13 @@
int count = 0; \
size_t idx; \
typeof(value) __value = (value); \
for (idx = 0; idx < (vec)->current; ++idx) { \
for (idx = 0; idx < (vec)->current; ) { \
if (cmp((vec)->elems[idx], __value)) { \
cleanup((vec)->elems[idx]); \
AST_VECTOR_REMOVE_UNORDERED((vec), idx); \
++count; \
} else { \
++idx; \
} \
} \
count; \
......@@ -417,14 +419,16 @@
int count = 0; \
size_t idx; \
typeof(value) __value = (value); \
for (idx = 0; idx < (vec)->current; ++idx) { \
for (idx = 0; idx < (vec)->current; ) { \
if (cmp((vec)->elems[idx], __value)) { \
cleanup((vec)->elems[idx]); \
AST_VECTOR_REMOVE_ORDERED((vec), idx); \
AST_VECTOR_REMOVE_ORDERED((vec), idx); \
++count; \
} else { \
++idx; \
} \
} \
oount; \
count; \
})
/*!
......@@ -445,7 +449,7 @@
for (idx = 0; idx < (vec)->current; ++idx) { \
if (cmp((vec)->elems[idx], __value)) { \
cleanup((vec)->elems[idx]); \
AST_VECTOR_REMOVE_ORDERED((vec), idx); \
AST_VECTOR_REMOVE_ORDERED((vec), idx); \
res = 0; \
break; \
} \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment