From e635708ea18fd308227c046eebba5ae7ae14ea01 Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Fri, 19 Mar 1999 08:47:20 +0000 Subject: [PATCH] removed static vars git-svn-id: svn://10.0.0.236/trunk@24431 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/base/src/nsString.cpp | 7 ++++++- mozilla/base/src/nsString.h | 2 ++ mozilla/string/obsolete/nsString.cpp | 7 ++++++- mozilla/string/obsolete/nsString.h | 2 ++ mozilla/xpcom/ds/nsString.cpp | 7 ++++++- mozilla/xpcom/ds/nsString.h | 2 ++ mozilla/xpcom/string/obsolete/nsString.cpp | 7 ++++++- mozilla/xpcom/string/obsolete/nsString.h | 2 ++ 8 files changed, 32 insertions(+), 4 deletions(-) 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);