[Asterisk-code-review] vector: After remove element recheck index (asterisk[13])
Richard Mudgett
asteriskteam at digium.com
Mon Oct 10 17:24:07 CDT 2016
Richard Mudgett has posted comments on this change.
Change subject: vector: After remove element recheck index
......................................................................
Patch Set 2: Code-Review-1
(2 comments)
https://gerrit.asterisk.org/#/c/4067/2/include/asterisk/vector.h
File include/asterisk/vector.h:
PS2, Line 371: for (idx = 0; idx < (vec)->current; ++idx) { \
: if (deleted) { \
: deleted = false; \
: --idx; \
: } \
: if (cmp((vec)->elems[idx], __value)) { \
: cleanup((vec)->elems[idx]); \
: AST_VECTOR_REMOVE_UNORDERED((vec), idx); \
: deleted = true; \
: ++count; \
: } \
: } \
Since you are trying to suppress/undo the idx increment, why not do this instead of adding the deleted variable:
for (idx = 0; idx < (vec)->current; ) {
if (cmp(...)) {
cleanup(...);
AST_VECTOR_REMOVE...
++count;
continue;
}
++idx;
}
Line 427: for (idx = 0; idx < (vec)->current; ++idx) { \
Same here
--
To view, visit https://gerrit.asterisk.org/4067
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib947fa94dc91dcd9341f357f1084782c64434eb7
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Badalian Vyacheslav <v.badalyan at open-bs.ru>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list