author | Karl Tomlinson <karlt+@karlt.net> |
Tue, 16 Oct 2018 21:07:20 +0000 | |
changeset 497808 | 5463ea36a953009a99dded33078b79f7c45b38aa |
parent 497807 | 0f7592b662e27238b8ebc442fa755e5e891cdef9 |
child 497809 | 386c46fc6e8dce5760f74427c125a63261c4b908 |
push id | 10002 |
push user | archaeopteryx@coole-files.de |
push date | Fri, 19 Oct 2018 23:09:29 +0000 |
treeherder | mozilla-beta@01378c910610 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dbaron |
bugs | 1499212 |
milestone | 64.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
|
xpcom/string/nsTStringRepr.h | file | annotate | diff | comparison | revisions | |
xpcom/string/nsTSubstring.h | file | annotate | diff | comparison | revisions |
--- a/xpcom/string/nsTStringRepr.h +++ b/xpcom/string/nsTStringRepr.h @@ -254,18 +254,18 @@ public: 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 // a char array *constant* declared without an explicit size. - // Do not attempt to use it with a regular char* pointer, or with a - // non-constant char array variable. Use EqualsASCII for them. + // Do not attempt to use it with a non-constant char array variable. + // Use EqualsASCII for that. // The template trick to acquire the array length at compile time without // using a macro is due to Corey Kosak, with much thanks. template<int N> inline bool EqualsLiteral(const char (&aStr)[N]) const { return EqualsASCII(aStr, N - 1); } @@ -276,19 +276,18 @@ public: // 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 // literal string, or a char array *constant* declared without an - // explicit size. Do not attempt to use it with a regular char* - // pointer, or with a non-constant char array variable. Use - // LowerCaseEqualsASCII for them. + // explicit size. Do not attempt to use it with a non-constant char array + // variable. Use LowerCaseEqualsASCII for that. template<int N> bool LowerCaseEqualsLiteral(const char (&aStr)[N]) const { return LowerCaseEqualsASCII(aStr, N - 1); } // Returns true if this string overlaps with the given string fragment. bool IsDependentOn(const char_type* aStart, const char_type* aEnd) const
--- a/xpcom/string/nsTSubstring.h +++ b/xpcom/string/nsTSubstring.h @@ -470,34 +470,34 @@ public: { return AssignASCII(aData, mozilla::AssertedCast<size_type, size_t>(strlen(aData)), aFallible); } // AssignLiteral must ONLY be applied to an actual literal string, or // a character array *constant* declared without an explicit size. - // Do not attempt to use it with a regular character pointer, or with a - // non-constant chararacter array variable. Use AssignASCII for those. + // Do not attempt to use it with a non-constant character array variable. + // Use AssignASCII for that. // // 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 - // a character array *constant* declared without an explicit size. - // Do not attempt to use it with a regular character pointer, or with a - // non-constant chararacter array variable. Use AssignASCII for those. + // 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 // takes a u"" string instead. Using the overload that takes a u"" // literal is generally preferred when working with 16-bit strings. // @@ -588,18 +588,18 @@ public: 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. - // Do not attempt to use it with a regular char* pointer, or with a char - // array variable. Use Replace or ReplaceASCII for those. + // 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); } void Append(char_type aChar); @@ -636,18 +636,18 @@ 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. - // Do not attempt to use it with a regular character pointer, or with a - // character array variable. Use Append or AppendASCII for those. + // 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, // please be sure to also check that // !(base_string_type::mDataFlags & DataFlags::REFCOUNTED) @@ -797,18 +797,18 @@ 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. - // Do not attempt to use it with a regular char* pointer, or with a char - // array variable. Use Insert for those. + // 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); } void Cut(index_type aCutStart, size_type aCutLength) {