editeng/source/editeng/editdoc.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
New commits: commit a78a7ee9f7b1db56a6fa7e082f410db5a8db2f18 Author: Kohei Yoshida <[email protected]> Date: Wed Apr 11 15:36:00 2012 -0400 Do this special case search only when the array is large enough. Otherwise the normal linear search should be sufficient. Eventually we need to use a better algorithm here than this special case handling... diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index f797d24..c791aa2 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -688,7 +688,7 @@ size_t FastGetPos(const _Array& rArray, const _Val* p, size_t& rLastPos) // Through certain filter code-paths we do a lot of appends, which in // turn call GetPos - creating some N^2 nightmares. If we have a // non-trivially large list, do a few checks from the end first. - if (rLastPos > 16) + if (rLastPos > 16 && nArrayLen > 16) { size_t nEnd; if (rLastPos > nArrayLen - 2) @@ -698,7 +698,7 @@ size_t FastGetPos(const _Array& rArray, const _Val* p, size_t& rLastPos) for (size_t nIdx = rLastPos - 2; nIdx < nEnd; ++nIdx) { - if (&rArray[nIdx] == p) + if (&rArray.at(nIdx) == p) { rLastPos = nIdx; return nIdx; @@ -707,7 +707,7 @@ size_t FastGetPos(const _Array& rArray, const _Val* p, size_t& rLastPos) } // The world's lamest linear search from svarray ... for (size_t nIdx = 0; nIdx < nArrayLen; ++nIdx) - if (&rArray[nIdx] == p) + if (&rArray.at(nIdx) == p) return rLastPos = nIdx; // 0xFFFF is used to signify "not found" condition. We need to change this. _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
