Closed Bug 1417279 Opened 3 years ago Closed 3 years ago
Array::Index Of a bit more sane
59 bytes, text/x-review-board-request
nsArray::IndexOf currently has two branches : one that calls through to the under lying Array's implementation of IndexOf and one that uses EnumerateForward with a closure (and that enumerates every element anyway). This appears to be because nsArray used to be based on nsVoidArray, which only had an IndexOf that took an element to find and no start index. Fortunately, we now live in the future. nsVoidArray is long gone and nsArray's underlying implementation is based on nsTArray, which has all the variants that one could ever hope for. We can get rid of the odd second case in IndexOf.  https://searchfox.org/mozilla-central/rev/a662f122c37704456457a526af90db4e3c0fd10e/xpcom/ds/nsArray.cpp#84
Comment on attachment 8928341 [details] Bug 1417279 - Remove an odd second case from nsArray::IndexOf. https://reviewboard.mozilla.org/r/199550/#review204646 ::: commit-message-b2f45:3 (Diff revision 1) > +Bug 1417279 - Remove an odd second case from nsArray::IndexOf. r=froydnj > + > +Now that nsArray uses nsTArray under the hood, we don't have to do weird Nit: make this `nsCOMArray`, rather than `nsTArray`, perhaps? It's all `nsTArray` in the end, saying `nsCOMArray` would be a little clearer?
Attachment #8928341 - Flags: review?(nfroyd) → review+
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/9ccc25047469 Remove an odd second case from nsArray::IndexOf. r=froydnj
You need to log in before you can comment on or make changes to this bug.