mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
2b3c79836e
ReplaceSubstring() is an O(n*m) algorithm (n being the length of the string and m being the number of occurrences of aTarget) because we have to move the remainder of the string, search it again and potentially memmove most of it again as we find more matches. This patch rewrites that function to make it O(n+m). Note that we currently don't build TestStrings.cpp, so the test case in this patch is not run automatically, but the test case has been verified to pass separately by moving the test function into Gecko and calling it during startup and stepping through it in the debugger. --HG-- extra : rebase_source : 0330c130520802392b92bd094dde85f57cfe6420 |
||
---|---|---|
.. | ||
crashtests | ||
moz.build | ||
nsAlgorithm.h | ||
nsAString.h | ||
nsCharTraits.h | ||
nsDependentString.cpp | ||
nsDependentString.h | ||
nsDependentSubstring.cpp | ||
nsDependentSubstring.h | ||
nsEmbedString.h | ||
nsLiteralString.h | ||
nsPrintfCString.h | ||
nsPromiseFlatString.cpp | ||
nsPromiseFlatString.h | ||
nsReadableUtils.cpp | ||
nsReadableUtils.h | ||
nsString.cpp | ||
nsString.h | ||
nsStringBuffer.h | ||
nsStringComparator.cpp | ||
nsStringFwd.h | ||
nsStringIterator.h | ||
nsStringObsolete.cpp | ||
nsSubstring.cpp | ||
nsSubstring.h | ||
nsSubstringTuple.cpp | ||
nsSubstringTuple.h | ||
nsTDependentString.cpp | ||
nsTDependentString.h | ||
nsTDependentSubstring.cpp | ||
nsTDependentSubstring.h | ||
nsTLiteralString.h | ||
nsTPromiseFlatString.cpp | ||
nsTPromiseFlatString.h | ||
nsTString.cpp | ||
nsTString.h | ||
nsTStringComparator.cpp | ||
nsTStringObsolete.cpp | ||
nsTSubstring.cpp | ||
nsTSubstring.h | ||
nsTSubstringTuple.cpp | ||
nsTSubstringTuple.h | ||
nsUTF8Utils.h | ||
nsUTF8UtilsSSE2.cpp | ||
nsXPCOMStrings.h | ||
nsXPIDLString.h | ||
README.html | ||
string-template-def-char.h | ||
string-template-def-unichar.h | ||
string-template-undef.h |
<html> <!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> <body> <h1><span class="LXRSHORTDESC">managing sequences of characters</span></h1> <p> <span class="LXRLONGDESC"></span> </p> </body> </html>