Bug 1499212 adjust Literal method doc so as not to imply that |this| must be a literal string r=dbaron
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 19 Oct 2018 01:07:10 +0000
changeset 490419 9cc9c8d06722b89670910b8d61ee41f884c43e48
parent 490418 19e29511c546e968d4d0ef6469a114267f1fa415
child 490420 3f6b347621b3ca43e9c54f36b9721fa4c070eda1
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersdbaron
bugs1499212
milestone64.0a1
Bug 1499212 adjust Literal method doc so as not to imply that |this| must be a literal string r=dbaron Depends on D8774 Differential Revision: https://phabricator.services.mozilla.com/D8775
xpcom/string/nsTStringRepr.h
xpcom/string/nsTSubstring.h
--- a/xpcom/string/nsTStringRepr.h
+++ b/xpcom/string/nsTStringRepr.h
@@ -252,17 +252,17 @@ public:
   // for wide strings. Call this version when you know the
   // length of 'data'.
   bool NS_FASTCALL EqualsASCII(const char* aData, size_type aLen) const;
   // An efficient comparison with ASCII that can be used even
   // for wide strings. Call this version when 'data' is
   // null-terminated.
   bool NS_FASTCALL EqualsASCII(const char* aData) const;
 
-  // EqualsLiteral must ONLY be applied to an actual literal string, or
+  // EqualsLiteral must ONLY be called with an actual literal string, or
   // a char array *constant* declared without an explicit size.
   // Do not attempt to use it with a non-constant char array variable.
   // Use EqualsASCII for that.
   // (Although this method may happen to produce expected results for other
   // char arrays that have bound one greater than the sequence of interest,
   // such use is discouraged for reasons of readability and maintainability.)
   // The template trick to acquire the array bound at compile time without
   // using a macro is due to Corey Kosak, with much thanks.
@@ -277,17 +277,17 @@ public:
   // ASCII/Literal string. The ASCII string is *not* lowercased for
   // you. If you compare to an ASCII or literal string that contains an
   // uppercase character, it is guaranteed to return false. We will
   // throw assertions too.
   bool NS_FASTCALL LowerCaseEqualsASCII(const char* aData,
                                         size_type aLen) const;
   bool NS_FASTCALL LowerCaseEqualsASCII(const char* aData) const;
 
-  // LowerCaseEqualsLiteral must ONLY be applied to an actual
+  // LowerCaseEqualsLiteral must ONLY be called with an actual
   // literal string, or a char array *constant* declared without an
   // explicit size.  Do not attempt to use it with a non-constant char array
   // variable. Use LowerCaseEqualsASCII for that.
   // (Although this method may happen to produce expected results for other
   // char arrays that have bound one greater than the sequence of interest,
   // such use is discouraged for reasons of readability and maintainability.)
   template<int N>
   bool LowerCaseEqualsLiteral(const char (&aStr)[N]) const
--- a/xpcom/string/nsTSubstring.h
+++ b/xpcom/string/nsTSubstring.h
@@ -468,34 +468,34 @@ public:
   MOZ_MUST_USE bool NS_FASTCALL AssignASCII(const char* aData,
                                             const fallible_t& aFallible)
   {
     return AssignASCII(aData,
                        mozilla::AssertedCast<size_type, size_t>(strlen(aData)),
                        aFallible);
   }
 
-  // AssignLiteral must ONLY be applied to an actual literal string, or
+  // AssignLiteral must ONLY be called with an actual literal string, or
   // a character array *constant* declared without an explicit size.
   // Do not attempt to use it with a character array variable that is not
   // constant or does not have static storage duration. Use Assign or
   // AssignASCII for those.
   //
   // This method does not need a fallible version, because it uses the
   // POD buffer of the literal as the string's buffer without allocating.
   // The literal does not need to be ASCII. If this a 16-bit string, this
   // method takes a u"" literal. (The overload on 16-bit strings that takes
   // a "" literal takes only ASCII.)
   template<int N>
   void AssignLiteral(const char_type (&aStr)[N])
   {
     AssignLiteral(aStr, N - 1);
   }
 
-  // AssignLiteral must ONLY be applied to an actual literal string, or
+  // AssignLiteral must ONLY be called with an actual literal string, or
   // a char array *constant* declared without an explicit size.
   // Do not attempt to use it with a non-constant char array variable.
   // Use AssignASCII for that.
   //
   // This method takes an 8-bit (ASCII-only!) string that is expanded
   // into a 16-bit string at run time causing a run-time allocation.
   // To avoid the run-time allocation (at the cost of the literal
   // taking twice the size in the binary), use the above overload that
@@ -588,17 +588,17 @@ public:
                                 const char* aData,
                                 size_type aLength = size_type(-1));
 
   MOZ_MUST_USE bool NS_FASTCALL ReplaceASCII(index_type aCutStart, size_type aCutLength,
                                              const char* aData,
                                              size_type aLength,
                                              const fallible_t&);
 
-  // ReplaceLiteral must ONLY be applied to an actual literal string.
+  // ReplaceLiteral must ONLY be called with an actual literal string.
   // Do not attempt to use it with a character array variable.
   // Use Replace or ReplaceASCII for that.
   template<int N>
   void ReplaceLiteral(index_type aCutStart, size_type aCutLength,
                       const char_type (&aStr)[N])
   {
     ReplaceLiteral(aCutStart, aCutLength, aStr, N - 1);
   }
@@ -636,17 +636,17 @@ public:
 
   MOZ_MUST_USE bool AppendASCII(const char* aData,
                                 size_type aLength,
                                 const fallible_t& aFallible);
 
   // Appends a literal string ("" literal in the 8-bit case and u"" literal
   // in the 16-bit case) to the string.
   //
-  // AppendLiteral must ONLY be applied to an actual literal string.
+  // AppendLiteral must ONLY be called with an actual literal string.
   // Do not attempt to use it with a character array variable.
   // Use Append or AppendASCII for that.
   template<int N>
   void AppendLiteral(const char_type (&aStr)[N])
   {
     // The case where base_string_type::mLength is zero is intentionally
     // left unoptimized (could be optimized as call to AssignLiteral),
     // because it's rare/nonexistent. If you add that optimization,
@@ -797,17 +797,17 @@ public:
   {
     Replace(aPos, 0, aStr);
   }
   void Insert(const substring_tuple_type& aTuple, index_type aPos)
   {
     Replace(aPos, 0, aTuple);
   }
 
-  // InsertLiteral must ONLY be applied to an actual literal string.
+  // InsertLiteral must ONLY be called with an actual literal string.
   // Do not attempt to use it with a character array variable.
   // Use Insert for that.
   template<int N>
   void InsertLiteral(const char_type (&aStr)[N], index_type aPos)
   {
     ReplaceLiteral(aPos, 0, aStr, N - 1);
   }