Bug 1492272 - Get rid of Begin/EndWriting(iterator&) string functions. r=froydnj
authorEric Rahm <erahm@mozilla.com>
Tue, 18 Sep 2018 13:35:09 -0700
changeset 437328 ee1700007d08879cde23c9fba8b8c5295e17a06a
parent 437327 4a608f94bcff10c205d9887d5c1b9e94c045e02e
child 437329 25d9357b7f486ef4ea79591f649f7f16c2f1c171
push id34675
push userbtara@mozilla.com
push dateWed, 19 Sep 2018 21:58:47 +0000
treeherdermozilla-central@9812141ec782 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1492272
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1492272 - Get rid of Begin/EndWriting(iterator&) string functions. r=froydnj This removes the rarely used and somewhat odd `iterator& BeginWriting/EndWriting(iterator&)` functions that take an iterator as an in/out param and then return it.
netwerk/base/nsStandardURL.cpp
xpcom/io/nsLocalFileCommon.cpp
xpcom/string/nsTSubstring.h
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -776,18 +776,17 @@ nsStandardURL::BuildNormalizedSpec(const
     }
 
     //
     // generate the normalized URL string
     //
     // approxLen should be correct or 1 high
     if (!mSpec.SetLength(approxLen+1, fallible)) // buf needs a trailing '\0' below
         return NS_ERROR_OUT_OF_MEMORY;
-    char *buf;
-    mSpec.BeginWriting(buf);
+    char *buf = mSpec.BeginWriting();
     uint32_t i = 0;
     int32_t diff = 0;
 
     if (mScheme.mLen > 0) {
         i = AppendSegmentToBuf(buf, i, spec, mScheme, mScheme);
         net_ToLowerCase(buf + mScheme.mPos, mScheme.mLen);
         i = AppendToBuf(buf, i, "://", 3);
     }
--- a/xpcom/io/nsLocalFileCommon.cpp
+++ b/xpcom/io/nsLocalFileCommon.cpp
@@ -215,20 +215,18 @@ nsLocalFile::GetRelativeDescriptor(nsIFi
     return rv;
   }
   rv = aFromFile->GetPath(fromPath);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   // get raw pointer to mutable string buffer
-  char16_t* thisPathPtr;
-  thisPath.BeginWriting(thisPathPtr);
-  char16_t* fromPathPtr;
-  fromPath.BeginWriting(fromPathPtr);
+  char16_t* thisPathPtr = thisPath.BeginWriting();
+  char16_t* fromPathPtr = fromPath.BeginWriting();
 
   SplitPath(thisPathPtr, thisNodes);
   SplitPath(fromPathPtr, fromNodes);
 
   size_t nodeIndex;
   for (nodeIndex = 0;
        nodeIndex < thisNodes.Length() && nodeIndex < fromNodes.Length();
        ++nodeIndex) {
--- a/xpcom/string/nsTSubstring.h
+++ b/xpcom/string/nsTSubstring.h
@@ -388,36 +388,16 @@ public:
     return base_string_type::mData + base_string_type::mLength;
   }
 
   iterator EndWriting(const fallible_t&)
   {
     return EnsureMutable() ? (base_string_type::mData + base_string_type::mLength) : iterator(0);
   }
 
-  iterator& BeginWriting(iterator& aIter)
-  {
-    return aIter = BeginWriting();
-  }
-
-  iterator& BeginWriting(iterator& aIter, const fallible_t& aFallible)
-  {
-    return aIter = BeginWriting(aFallible);
-  }
-
-  iterator& EndWriting(iterator& aIter)
-  {
-    return aIter = EndWriting();
-  }
-
-  iterator& EndWriting(iterator& aIter, const fallible_t& aFallible)
-  {
-    return aIter = EndWriting(aFallible);
-  }
-
   /**
    * Perform string to int conversion.
    * @param   aErrorCode will contain error if one occurs
    * @param   aRadix is the radix to use. Only 10 and 16 are supported.
    * @return  int rep of string value, and possible (out) error code
    */
   int32_t ToInteger(nsresult* aErrorCode, uint32_t aRadix = 10) const;