[Asterisk-code-review] vector: After remove element recheck index (asterisk[13])

Badalian Vyacheslav asteriskteam at digium.com
Mon Oct 10 18:05:41 CDT 2016


Badalian Vyacheslav has posted comments on this change.

Change subject: vector: After remove element recheck index
......................................................................


Patch Set 3:

(3 comments)

https://gerrit.asterisk.org/#/c/4067/3/include/asterisk/vector.h
File include/asterisk/vector.h:

Line 370: 	for (idx = ((vec)->current - 1); idx >= 0; --idx) {		\
> This isn't going to work because size_t is unsigned.  What happens when you
Thank you. I'll fix it now. In Russia we have a deep night. The brain slows down :)


Line 370: 	for (idx = ((vec)->current - 1); idx >= 0; --idx) {		\
> Not a huge deal (just less optimized), but wouldn't this result in elements
Where is the problem?
1. When not sorted vector in removing we transfer vector from the end of the current elements onto.
2. When we shift vector sorting all that after the removal of the current element.

In both cases, the elements do not change before the change point. A current element is already verified. Because always shifted after the index.


Line 370: 	for (idx = ((vec)->current - 1); idx >= 0; --idx) {		\
> Is it valid to check (idx >= 0) when idx is size_t (unsigned)?  If it's imp
Thank you. I'll fix it now. In Russia we have a deep night. The brain slows down :)


-- 
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: 3
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Badalian Vyacheslav <v.badalyan at open-bs.ru>
Gerrit-Reviewer: Badalian Vyacheslav <v.badalyan at open-bs.ru>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list