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
--- 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) {