gecko-dev/xpcom/string
Ehsan Akhgari 2b3c79836e 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 : 0330c130520802392b92bd094dde85f57cfe6420
2014-12-12 11:47:55 -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 Bug 1046841 - Fix more style violations in previously touched .h files in xpcom/. r=froydnj 2014-08-25 12:17:24 -07:00
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 11:47:55 -05:00
nsSubstring.h
nsSubstringTuple.cpp
nsSubstringTuple.h
nsTDependentString.cpp
nsTDependentString.h
nsTDependentSubstring.cpp
nsTDependentSubstring.h
nsTLiteralString.h
nsTPromiseFlatString.cpp
nsTPromiseFlatString.h Bug 1065774 - Be more precise in PromiseFlatString docs about why assigning PromiseFlatString(...) to a reference is safe. r=froydnj 2014-09-11 13:25:56 -07:00
nsTString.cpp Bug 1046841 - Fix more style violations in previously touched .cpp files in xpcom/. r=froydnj 2014-08-25 12:17:15 -07:00
nsTString.h Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj 2014-12-12 11:47:55 -05:00
nsTStringComparator.cpp
nsTStringObsolete.cpp Bug 1101337 - Make the ReplaceSubstring() XPCOM string API linear; r=froydnj 2014-12-12 11:47:55 -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 Bug 1046841 - Fix more style violations in previously touched .cpp files in xpcom/. r=froydnj 2014-08-25 12:17:15 -07:00
nsTSubstringTuple.h
nsUTF8Utils.h Bug 1025183 P2 Document how UTF16CharEnumerator treats buffer position on error. r=bz 2014-08-01 16:23:48 -04:00
nsUTF8UtilsSSE2.cpp Bug 1046841 - Fix more style violations in previously touched .cpp files in xpcom/. r=froydnj 2014-08-25 12:17:15 -07:00
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>