gecko/xpcom/string
Ehsan Akhgari 5b56680479 Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj
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 : b020e17c1973330b0dbbd6bf956c073cfdcb775e
2014-12-12 18:57:09 -05:00
..
crashtests
moz.build Bug 1107814 - Part 1: Mark more directories as FAIL_ON_WARNINGS for all compilers. r=gps 2014-12-04 16:24:03 -08:00
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 Bug 1097283: Fix count/byte mismatches in NS_ABORT_OOM calls. r=froydnj 2014-11-12 21:13:44 +13:00
nsReadableUtils.h
nsString.cpp
nsString.h
nsStringBuffer.h
nsStringComparator.cpp
nsStringFwd.h
nsStringIterator.h
nsStringObsolete.cpp Bug 1097283: Fix count/byte mismatches in NS_ABORT_OOM calls. r=froydnj 2014-11-12 21:13:44 +13:00
nsSubstring.cpp Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj 2014-12-12 18:57:09 -05:00
nsSubstring.h
nsSubstringTuple.cpp
nsSubstringTuple.h
nsTDependentString.cpp
nsTDependentString.h
nsTDependentSubstring.cpp
nsTDependentSubstring.h
nsTLiteralString.h
nsTPromiseFlatString.cpp
nsTPromiseFlatString.h
nsTString.cpp
nsTString.h Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj 2014-12-12 18:57:09 -05:00
nsTStringComparator.cpp
nsTStringObsolete.cpp Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj 2014-12-12 18:57:09 -05:00
nsTSubstring.cpp Bug 1097283: Fix count/byte mismatches in NS_ABORT_OOM calls. r=froydnj 2014-11-12 21:13:44 +13:00
nsTSubstring.h No bug - add a comment to clarify the code. DONTBUILD 2014-11-13 08:57:09 +13:00
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>