Bug 909467 - Put the StringBuilder in Element.cpp into the anonymous namespace to prevent anything outside that file from accidentally being linked against it. r=bz
authorJonathan Watt <jwatt@jwatt.org>
Tue, 10 Sep 2013 02:07:36 +0100
changeset 146407 4ab57d0318fff7d71ac795724939b6faeccf16a8
parent 146406 ac51f4fe929947da50270ee743ab1387860301a2
child 146408 255093e2f430a62554a139327f479c5e9cbc9ce4
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbz
bugs909467
milestone26.0a1
Bug 909467 - Put the StringBuilder in Element.cpp into the anonymous namespace to prevent anything outside that file from accidentally being linked against it. r=bz
content/base/src/Element.cpp
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -2446,16 +2446,21 @@ Element::MozRequestFullScreen()
   OwnerDoc()->AsyncRequestFullScreen(this);
 
   return;
 }
 
 // Try to keep the size of StringBuilder close to a jemalloc bucket size.
 #define STRING_BUFFER_UNITS 1020
 
+namespace {
+
+// We put StringBuilder in the anonymous namespace to prevent anything outside
+// this file from accidentally being linked against it.
+
 class StringBuilder
 {
 private:
   class Unit
   {
   public:
     Unit() : mAtom(nullptr), mType(eUnknown), mLength(0)
     {
@@ -2709,16 +2714,18 @@ private:
 
   nsAutoTArray<Unit, STRING_BUFFER_UNITS> mUnits;
   nsAutoPtr<StringBuilder>                mNext;
   StringBuilder*                          mLast;
   // mLength is used only in the first StringBuilder object in the linked list.
   uint32_t                                mLength;
 };
 
+} // anonymous namespace
+
 static void
 AppendEncodedCharacters(const nsTextFragment* aText, StringBuilder& aBuilder)
 {
   uint32_t extraSpaceNeeded = 0;
   uint32_t len = aText->GetLength();
   if (aText->Is2b()) {
     const PRUnichar* data = aText->Get2b();
     for (uint32_t i = 0; i < len; ++i) {