diff --git a/mozilla/base/src/nsString.cpp b/mozilla/base/src/nsString.cpp index 4927f0fbcec..72a033a4df0 100644 --- a/mozilla/base/src/nsString.cpp +++ b/mozilla/base/src/nsString.cpp @@ -41,8 +41,9 @@ const char* kFoolMsg = "Error: Some fool overwrote the shared buffer."; PRUnichar kCommonEmptyBuffer[100]; //shared by all strings; NEVER WRITE HERE!!! +#ifdef NS_DEBUG PRBool nsString::mSelfTested = PR_FALSE; - +#endif #define NOT_USED 0xfffd @@ -171,10 +172,12 @@ nsString::nsString() { NS_ASSERTION(kCommonEmptyBuffer[0]==0,kFoolMsg); mLength = mCapacity = 0; mStr = kCommonEmptyBuffer; +#ifdef NS_DEBUG if(!mSelfTested) { mSelfTested=PR_TRUE; SelfTest(); } +#endif } @@ -2208,7 +2211,9 @@ void nsString::SelfTest(void) { static const char* kComparisonError = "Comparision error!"; static const char* kEqualsError = "Equals error!"; +#ifdef NS_DEBUG mSelfTested=PR_TRUE; +#endif nsAutoString as("Hello there"); as.SelfTest(); diff --git a/mozilla/base/src/nsString.h b/mozilla/base/src/nsString.h index 838a191574d..38ee3929bab 100644 --- a/mozilla/base/src/nsString.h +++ b/mozilla/base/src/nsString.h @@ -760,7 +760,9 @@ typedef PRUnichar chartype; chartype* mStr; PRInt32 mLength; PRInt32 mCapacity; +#ifdef NS_DEBUG static PRBool mSelfTested; +#endif }; ostream& operator<<(ostream& os,nsString& aString); diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp index 4927f0fbcec..72a033a4df0 100644 --- a/mozilla/string/obsolete/nsString.cpp +++ b/mozilla/string/obsolete/nsString.cpp @@ -41,8 +41,9 @@ const char* kFoolMsg = "Error: Some fool overwrote the shared buffer."; PRUnichar kCommonEmptyBuffer[100]; //shared by all strings; NEVER WRITE HERE!!! +#ifdef NS_DEBUG PRBool nsString::mSelfTested = PR_FALSE; - +#endif #define NOT_USED 0xfffd @@ -171,10 +172,12 @@ nsString::nsString() { NS_ASSERTION(kCommonEmptyBuffer[0]==0,kFoolMsg); mLength = mCapacity = 0; mStr = kCommonEmptyBuffer; +#ifdef NS_DEBUG if(!mSelfTested) { mSelfTested=PR_TRUE; SelfTest(); } +#endif } @@ -2208,7 +2211,9 @@ void nsString::SelfTest(void) { static const char* kComparisonError = "Comparision error!"; static const char* kEqualsError = "Equals error!"; +#ifdef NS_DEBUG mSelfTested=PR_TRUE; +#endif nsAutoString as("Hello there"); as.SelfTest(); diff --git a/mozilla/string/obsolete/nsString.h b/mozilla/string/obsolete/nsString.h index 838a191574d..38ee3929bab 100644 --- a/mozilla/string/obsolete/nsString.h +++ b/mozilla/string/obsolete/nsString.h @@ -760,7 +760,9 @@ typedef PRUnichar chartype; chartype* mStr; PRInt32 mLength; PRInt32 mCapacity; +#ifdef NS_DEBUG static PRBool mSelfTested; +#endif }; ostream& operator<<(ostream& os,nsString& aString); diff --git a/mozilla/xpcom/ds/nsString.cpp b/mozilla/xpcom/ds/nsString.cpp index 4927f0fbcec..72a033a4df0 100644 --- a/mozilla/xpcom/ds/nsString.cpp +++ b/mozilla/xpcom/ds/nsString.cpp @@ -41,8 +41,9 @@ const char* kFoolMsg = "Error: Some fool overwrote the shared buffer."; PRUnichar kCommonEmptyBuffer[100]; //shared by all strings; NEVER WRITE HERE!!! +#ifdef NS_DEBUG PRBool nsString::mSelfTested = PR_FALSE; - +#endif #define NOT_USED 0xfffd @@ -171,10 +172,12 @@ nsString::nsString() { NS_ASSERTION(kCommonEmptyBuffer[0]==0,kFoolMsg); mLength = mCapacity = 0; mStr = kCommonEmptyBuffer; +#ifdef NS_DEBUG if(!mSelfTested) { mSelfTested=PR_TRUE; SelfTest(); } +#endif } @@ -2208,7 +2211,9 @@ void nsString::SelfTest(void) { static const char* kComparisonError = "Comparision error!"; static const char* kEqualsError = "Equals error!"; +#ifdef NS_DEBUG mSelfTested=PR_TRUE; +#endif nsAutoString as("Hello there"); as.SelfTest(); diff --git a/mozilla/xpcom/ds/nsString.h b/mozilla/xpcom/ds/nsString.h index 838a191574d..38ee3929bab 100644 --- a/mozilla/xpcom/ds/nsString.h +++ b/mozilla/xpcom/ds/nsString.h @@ -760,7 +760,9 @@ typedef PRUnichar chartype; chartype* mStr; PRInt32 mLength; PRInt32 mCapacity; +#ifdef NS_DEBUG static PRBool mSelfTested; +#endif }; ostream& operator<<(ostream& os,nsString& aString); diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp index 4927f0fbcec..72a033a4df0 100644 --- a/mozilla/xpcom/string/obsolete/nsString.cpp +++ b/mozilla/xpcom/string/obsolete/nsString.cpp @@ -41,8 +41,9 @@ const char* kFoolMsg = "Error: Some fool overwrote the shared buffer."; PRUnichar kCommonEmptyBuffer[100]; //shared by all strings; NEVER WRITE HERE!!! +#ifdef NS_DEBUG PRBool nsString::mSelfTested = PR_FALSE; - +#endif #define NOT_USED 0xfffd @@ -171,10 +172,12 @@ nsString::nsString() { NS_ASSERTION(kCommonEmptyBuffer[0]==0,kFoolMsg); mLength = mCapacity = 0; mStr = kCommonEmptyBuffer; +#ifdef NS_DEBUG if(!mSelfTested) { mSelfTested=PR_TRUE; SelfTest(); } +#endif } @@ -2208,7 +2211,9 @@ void nsString::SelfTest(void) { static const char* kComparisonError = "Comparision error!"; static const char* kEqualsError = "Equals error!"; +#ifdef NS_DEBUG mSelfTested=PR_TRUE; +#endif nsAutoString as("Hello there"); as.SelfTest(); diff --git a/mozilla/xpcom/string/obsolete/nsString.h b/mozilla/xpcom/string/obsolete/nsString.h index 838a191574d..38ee3929bab 100644 --- a/mozilla/xpcom/string/obsolete/nsString.h +++ b/mozilla/xpcom/string/obsolete/nsString.h @@ -760,7 +760,9 @@ typedef PRUnichar chartype; chartype* mStr; PRInt32 mLength; PRInt32 mCapacity; +#ifdef NS_DEBUG static PRBool mSelfTested; +#endif }; ostream& operator<<(ostream& os,nsString& aString);