Bug 1445079 - Rename nsHTMLTags::sTagUnicodeTable[] as sTagNames[]. r=froydnj
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 13 Mar 2018 10:12:10 +1100
changeset 766512 e08d2fc661202c8d30ba649df5d314b67882c951
parent 765253 02a9e772183cc47ee6e7dec944a4996ff047c8f6
child 766513 837b409fa5b4dfc230641376f53cdf7e18d66448
push id102337
push usernnethercote@mozilla.com
push dateMon, 12 Mar 2018 23:15:09 +0000
reviewersfroydnj
bugs1445079
milestone60.0a1
Bug 1445079 - Rename nsHTMLTags::sTagUnicodeTable[] as sTagNames[]. r=froydnj It's just an array of names, not a hash table. MozReview-Commit-ID: 3rWNNec64UJ
parser/htmlparser/nsHTMLTags.cpp
parser/htmlparser/nsHTMLTags.h
--- a/parser/htmlparser/nsHTMLTags.cpp
+++ b/parser/htmlparser/nsHTMLTags.cpp
@@ -13,17 +13,17 @@
 #include "mozilla/HashFunctions.h"
 #include <algorithm>
 
 using namespace mozilla;
 
 // static array of unicode tag names
 #define HTML_TAG(_tag, _classname, _interfacename) (u"" #_tag),
 #define HTML_OTHER(_tag)
-const char16_t* const nsHTMLTags::sTagUnicodeTable[] = {
+const char16_t* const nsHTMLTags::sTagNames[] = {
 #include "nsHTMLTagList.h"
 };
 #undef HTML_TAG
 #undef HTML_OTHER
 
 int32_t nsHTMLTags::gTableRefCount;
 nsHTMLTags::TagStringHash* nsHTMLTags::gTagTable;
 nsHTMLTags::TagAtomHash* nsHTMLTags::gTagAtomTable;
@@ -63,25 +63,25 @@ nsHTMLTags::RegisterAtoms(void)
       nsAutoString temp2((char16_t*)sTagAtomSetup[i].mString);
       ToLowerCase(temp1);
       NS_ASSERTION(temp1.Equals(temp2), "upper case char in table");
     }
 
     // let's verify that all names in the unicode strings above are
     // correct.
     for (int32_t i = 0; i < NS_HTML_TAG_MAX; ++i) {
-      nsAutoString temp1(sTagUnicodeTable[i]);
+      nsAutoString temp1(sTagNames[i]);
       nsAutoString temp2((char16_t*)sTagAtomSetup[i].mString);
       NS_ASSERTION(temp1.Equals(temp2), "Bad unicode tag name!");
     }
 
     // let's verify that NS_HTMLTAG_NAME_MAX_LENGTH is correct
     uint32_t maxTagNameLength = 0;
     for (int32_t i = 0; i < NS_HTML_TAG_MAX; ++i) {
-      uint32_t len = NS_strlen(sTagUnicodeTable[i]);
+      uint32_t len = NS_strlen(sTagNames[i]);
       maxTagNameLength = std::max(len, maxTagNameLength);
     }
     NS_ASSERTION(maxTagNameLength == NS_HTMLTAG_NAME_MAX_LENGTH,
                  "NS_HTMLTAG_NAME_MAX_LENGTH not set correctly!");
   }
 #endif
 }
 
@@ -96,17 +96,17 @@ nsHTMLTags::AddRefTable(void)
     gTagAtomTable = new TagAtomHash(64);
 
     // Fill in gTagTable with the above static char16_t strings as
     // keys and the value of the corresponding enum as the value in
     // the table.
 
     int32_t i;
     for (i = 0; i < NS_HTML_TAG_MAX; ++i) {
-      const char16_t* tagName = sTagUnicodeTable[i];
+      const char16_t* tagName = sTagNames[i];
       const nsHTMLTag tagValue = static_cast<nsHTMLTag>(i + 1);
       // We use AssignLiteral here to avoid a string copy. This is okay
       // because this is truly static data.
       nsString tmp;
       tmp.AssignLiteral(tagName, nsString::char_traits::length(tagName));
       gTagTable->Put(tmp, tagValue);
       gTagAtomTable->Put(sTagAtomTable[i], tagValue);
     }
@@ -167,17 +167,17 @@ nsHTMLTags::TestTagTable()
 {
      const char16_t *tag;
      nsHTMLTag id;
      RefPtr<nsAtom> atom;
 
      nsHTMLTags::AddRefTable();
      // Make sure we can find everything we are supposed to
      for (int i = 0; i < NS_HTML_TAG_MAX; ++i) {
-       tag = sTagUnicodeTable[i];
+       tag = sTagNames[i];
        const nsAString& tagString = nsDependentString(tag);
        id = StringTagToId(tagString);
        NS_ASSERTION(id != eHTMLTag_userdefined, "can't find tag id");
 
        nsAutoString uname(tagString);
        ToUpperCase(uname);
        NS_ASSERTION(id == StringTagToId(uname), "wrong id");
 
--- a/parser/htmlparser/nsHTMLTags.h
+++ b/parser/htmlparser/nsHTMLTags.h
@@ -73,16 +73,16 @@ public:
 
 #ifdef DEBUG
   static void TestTagTable();
 #endif
 
 private:
   // This would use NS_STATIC_ATOM_DECL if it wasn't an array.
   static nsStaticAtom* sTagAtomTable[eHTMLTag_userdefined - 1];
-  static const char16_t* const sTagUnicodeTable[];
+  static const char16_t* const sTagNames[];
 
   static int32_t gTableRefCount;
   static TagStringHash* gTagTable;
   static TagAtomHash* gTagAtomTable;
 };
 
 #endif /* nsHTMLTags_h___ */