Bug 1305422 - part 3 - don't call size_forward in nsTStringComparator.cpp; r=erahm
authorNathan Froyd <froydnj@mozilla.com>
Thu, 29 Sep 2016 22:33:58 -0400
changeset 315873 e208dfe24c94f7c3cddbc27df9e49d7fadc2acaf
parent 315872 8313868b4334a07005ec359e6b0745ee395f10ad
child 315874 a5b04e48b3e8e70b8a213afb75170da85c4d5b62
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1305422
milestone52.0a1
Bug 1305422 - part 3 - don't call size_forward in nsTStringComparator.cpp; r=erahm Asking for size_forward on an iterator that you haven't started reading from is just asking for the length of the original string, so use that instead.
xpcom/string/nsTStringComparator.cpp
--- a/xpcom/string/nsTStringComparator.cpp
+++ b/xpcom/string/nsTStringComparator.cpp
@@ -14,18 +14,18 @@ Compare(const nsTSubstring_CharT::base_s
   if (&aLhs == &aRhs) {
     return 0;
   }
 
   nsTSubstring_CharT::const_iterator leftIter, rightIter;
   aLhs.BeginReading(leftIter);
   aRhs.BeginReading(rightIter);
 
-  size_type lLength = leftIter.size_forward();
-  size_type rLength = rightIter.size_forward();
+  size_type lLength = aLhs.Length();
+  size_type rLength = aRhs.Length();
   size_type lengthToCompare = XPCOM_MIN(lLength, rLength);
 
   int result;
   if ((result = comp(leftIter.get(), rightIter.get(),
                      lengthToCompare, lengthToCompare)) == 0) {
     if (lLength < rLength) {
       result = -1;
     } else if (rLength < lLength) {