diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index b4e6fbc7425..67758eb835a 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -302,11 +302,11 @@ nsHTMLDocument::~nsHTMLDocument() mBaseTarget = nsnull; } if (nsnull != mLastModified) { - nsString::Recycle(mLastModified); + delete mLastModified; mLastModified = nsnull; } if (nsnull != mReferrer) { - nsString::Recycle(mReferrer); + delete mReferrer; mReferrer = nsnull; } NS_IF_RELEASE(mParser); @@ -1183,7 +1183,7 @@ nsHTMLDocument::SetLastModified(const nsAReadableString& aLastModified) } } else if (nsnull != mLastModified) { - nsString::Recycle(mLastModified); + delete mLastModified; mLastModified = nsnull; } @@ -1202,7 +1202,7 @@ nsHTMLDocument::SetReferrer(const nsAReadableString& aReferrer) } } else if (nsnull != mReferrer) { - nsString::Recycle(mReferrer); + delete mReferrer; mReferrer = nsnull; } diff --git a/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp b/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp index 5df2d330ba7..139671f6c9a 100644 --- a/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp +++ b/mozilla/gfx/src/mac/nsUnicodeMappingUtil.cpp @@ -67,7 +67,7 @@ void nsUnicodeMappingUtil::CleanUp() for(int i= 0 ; i < smPseudoTotalScripts; i ++) { for(int j=0; j < 5; j++) { if(mGenericFontMapping[i][j]) - nsString::Recycle(mGenericFontMapping[i][j]); + delete mGenericFontMapping[i][j]; } } if (mCache) @@ -326,11 +326,11 @@ PrefEnumCallback(const char* aName, void* aClosure) if( (! nsDeviceContextMac::GetMacFontNumber(*fontname, fontID)) || ((script < smUninterp) && (::FontToScript(fontID) != script))) { - nsString::Recycle(fontname); + delete fontname; return; } if( Self->mGenericFontMapping[script][type] ) - nsString::Recycle(Self->mGenericFontMapping[script][type]); + delete Self->mGenericFontMapping[script][type]; Self->mGenericFontMapping[script][type] = fontname; #ifdef DEBUG_ftang_font char* utf8 = fontname->ToNewUTF8String(); @@ -393,7 +393,7 @@ void nsUnicodeMappingUtil::InitScriptFontMapping() if (nsDeviceContextMac::GetMacFontNumber (*fontname,fontID)) mScriptFontMapping[script] = fontID; - nsString::Recycle (fontname); + delete fontname; } } } diff --git a/mozilla/mailnews/base/search/src/nsMsgSearchTerm.cpp b/mozilla/mailnews/base/search/src/nsMsgSearchTerm.cpp index 9538a6a9ab3..8cd48a8f250 100644 --- a/mozilla/mailnews/base/search/src/nsMsgSearchTerm.cpp +++ b/mozilla/mailnews/base/search/src/nsMsgSearchTerm.cpp @@ -778,9 +778,6 @@ nsresult nsMsgSearchTerm::MatchRfc2047String (const char *rfc2047string, res = MatchString(stringToMatch, charset, pResult); -// if (mimedecode == PR_TRUE) -// nsString::Recycle(&decodedString); - return res; } diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp index 7e74748a55e..ade2c679bd6 100644 --- a/mozilla/string/obsolete/nsString.cpp +++ b/mozilla/string/obsolete/nsString.cpp @@ -545,7 +545,8 @@ nsCString* nsCString::ToNewString() const { /** * Creates an ascii clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @update gess 02/24/00 * @return ptr to new ascii string */ @@ -555,7 +556,8 @@ char* nsCString::ToNewCString() const { /** * Creates an unicode clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @update gess 01/04/99 * @return ptr to new ascii string */ @@ -1311,94 +1313,6 @@ PRBool nsCString::EqualsWithConversion(const PRUnichar* aString,PRBool aIgnoreCa return result; } - -/************************************************************** - Define the string deallocator class... - **************************************************************/ -#ifndef RICKG_TESTBED -class nsCStringDeallocator: public nsDequeFunctor{ -public: - virtual void* operator()(void* anObject) { - nsCString* aString= (nsCString*)anObject; - if(aString){ - delete aString; - } - return 0; - } -}; -#endif - -/**************************************************************************** - * This class, appropriately enough, creates and recycles nsCString objects.. - ****************************************************************************/ - - - -#ifndef RICKG_TESTBED -class nsCStringRecycler { -public: - nsCStringRecycler() : mDeque(0) { - } - - ~nsCStringRecycler() { - nsCStringDeallocator theDeallocator; - mDeque.ForEach(theDeallocator); //now delete the strings - } - - void Recycle(nsCString* aString) { - mDeque.Push(aString); - } - - nsCString* CreateString(void){ - nsCString* result=(nsCString*)mDeque.Pop(); - if(!result) - result=new nsCString(); - return result; - } - nsDeque mDeque; -}; -static nsCStringRecycler& GetRecycler(void); - - -/** - * - * @update gess 01/04/99 - * @param - * @return - */ -nsCStringRecycler& GetRecycler(void){ - static nsCStringRecycler gCRecycler; - return gCRecycler; -} - -#endif - -/** - * Call this mehod when you're done - * @update gess 01/04/99 - * @param - * @return - */ -nsCString* nsCString::CreateString(void){ - nsCString* result=0; -#ifndef RICKG_TESTBED - result=GetRecycler().CreateString(); -#endif - return result; -} - -/** - * Call this mehod when you're done - * @update gess 01/04/99 - * @param - * @return - */ -void nsCString::Recycle(nsCString* aString){ -#ifndef RICKG_TESTBED - GetRecycler().Recycle(aString); -#endif -} - #if 0 /** diff --git a/mozilla/string/obsolete/nsString.h b/mozilla/string/obsolete/nsString.h index 1220ac752bc..5b1580f900f 100644 --- a/mozilla/string/obsolete/nsString.h +++ b/mozilla/string/obsolete/nsString.h @@ -246,14 +246,16 @@ public: /** * Creates an ISOLatin1 clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @return ptr to new isolatin1 string */ char* ToNewCString() const; /** * Creates a unicode clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @return ptr to new unicode string */ PRUnichar* ToNewUnicode() const; @@ -435,10 +437,6 @@ public: void DebugDump(void) const; - - static void Recycle(nsCString* aString); - static nsCString* CreateString(void); - private: // NOT TO BE IMPLEMENTED // these signatures help clients not accidentally call the wrong thing helped by C++ automatic integral promotion diff --git a/mozilla/string/obsolete/nsString2.cpp b/mozilla/string/obsolete/nsString2.cpp index c07c3aec703..0bd70072a25 100644 --- a/mozilla/string/obsolete/nsString2.cpp +++ b/mozilla/string/obsolete/nsString2.cpp @@ -582,7 +582,8 @@ nsString* nsString::ToNewString() const { /** * Creates an ascii clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @update gess 02/24/00 * @WARNING! Potential i18n issue here, since we're stepping down from 2byte chars to 1byte chars! * @return ptr to new ascii string @@ -599,7 +600,8 @@ char* nsString::ToNewCString() const { /** * Creates an UTF8 clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @update ftang 09/10/99 * @return ptr to new UTF8 string * http://www.cis.ohio-state.edu/htbin/rfc/rfc2279.html @@ -627,7 +629,8 @@ char* nsString::ToNewUTF8String() const { /** * Creates an ascii clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @update gess 02/24/00 * @return ptr to new ascii string */ @@ -1527,90 +1530,6 @@ PRBool nsString::IsDigit(PRUnichar aChar) { return PRBool((aChar >= '0') && (aChar <= '9')); } -#ifndef RICKG_TESTBED -/************************************************************** - Define the string deallocator class... - **************************************************************/ -class nsStringDeallocator: public nsDequeFunctor{ -public: - virtual void* operator()(void* anObject) { - nsString* aString= (nsString*)anObject; - if(aString){ - delete aString; - } - return 0; - } -}; - -/**************************************************************************** - * This class, appropriately enough, creates and recycles nsString objects.. - ****************************************************************************/ - -class nsStringRecycler { -public: - nsStringRecycler() : mDeque(0) { - } - - ~nsStringRecycler() { - nsStringDeallocator theDeallocator; - mDeque.ForEach(theDeallocator); //now delete the strings - } - - void Recycle(nsString* aString) { - mDeque.Push(aString); - } - - nsString* CreateString(void){ - nsString* result=(nsString*)mDeque.Pop(); - if(!result) - result=new nsString(); - return result; - } - nsDeque mDeque; -}; -static nsStringRecycler& GetRecycler(void); - -/** - * - * @update gess 01/04/99 - * @param - * @return - */ -nsStringRecycler& GetRecycler(void){ - static nsStringRecycler gRecycler; - return gRecycler; -} -#endif - - -/** - * Call this mehod when you're done - * @update gess 01/04/99 - * @param - * @return - */ -nsString* nsString::CreateString(void){ - nsString* result=0; -#ifndef RICKG_TESTBED - GetRecycler().CreateString(); -#endif - return result; -} - -/** - * Call this mehod when you're done - * @update gess 01/04/99 - * @param - * @return - */ -void nsString::Recycle(nsString* aString){ -#ifndef RICKG_TESTBED - GetRecycler().Recycle(aString); -#else - delete aString; -#endif -} - #if 0 /** diff --git a/mozilla/string/obsolete/nsString2.h b/mozilla/string/obsolete/nsString2.h index a5c9b65d6a6..b7e954fe179 100644 --- a/mozilla/string/obsolete/nsString2.h +++ b/mozilla/string/obsolete/nsString2.h @@ -276,21 +276,24 @@ public: /** * Creates an ISOLatin1 clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @return ptr to new isolatin1 string */ char* ToNewCString() const; /** * Creates an UTF8 clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @return ptr to new null-terminated UTF8 string */ char* ToNewUTF8String() const; /** * Creates a unicode clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @return ptr to new unicode string */ PRUnichar* ToNewUnicode() const; @@ -506,9 +509,6 @@ public: */ static PRBool IsDigit(PRUnichar ch); - static void Recycle(nsString* aString); - static nsString* CreateString(void); - private: // NOT TO BE IMPLEMENTED // these signatures help clients not accidentally call the wrong thing helped by C++ automatic integral promotion diff --git a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp index b7e8fafc836..b7fcd749089 100644 --- a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp +++ b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp @@ -168,8 +168,8 @@ nsIMEPreedit::nsIMEPreedit() nsIMEPreedit::~nsIMEPreedit() { mCaretPosition = 0; - nsString::Recycle(mIMECompUnicode); - nsCString::Recycle(mIMECompAttr); + delete mIMECompUnicode; + delete mIMECompAttr; if (mCompositionUniString) { delete[] mCompositionUniString; } diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index b428d78ce58..4fc91451dfc 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -517,9 +517,9 @@ nsWindow::~nsWindow() // delete any of the IME structures that we allocated // if (mIMECompString!=NULL) - nsCString::Recycle(mIMECompString); + delete mIMECompString; if (mIMECompUnicode!=NULL) - nsString::Recycle(mIMECompUnicode); + delete mIMECompUnicode; if (mIMEAttributeString!=NULL) delete [] mIMEAttributeString; if (mIMECompClauseString!=NULL) diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp index 7e74748a55e..ade2c679bd6 100644 --- a/mozilla/xpcom/string/obsolete/nsString.cpp +++ b/mozilla/xpcom/string/obsolete/nsString.cpp @@ -545,7 +545,8 @@ nsCString* nsCString::ToNewString() const { /** * Creates an ascii clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @update gess 02/24/00 * @return ptr to new ascii string */ @@ -555,7 +556,8 @@ char* nsCString::ToNewCString() const { /** * Creates an unicode clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @update gess 01/04/99 * @return ptr to new ascii string */ @@ -1311,94 +1313,6 @@ PRBool nsCString::EqualsWithConversion(const PRUnichar* aString,PRBool aIgnoreCa return result; } - -/************************************************************** - Define the string deallocator class... - **************************************************************/ -#ifndef RICKG_TESTBED -class nsCStringDeallocator: public nsDequeFunctor{ -public: - virtual void* operator()(void* anObject) { - nsCString* aString= (nsCString*)anObject; - if(aString){ - delete aString; - } - return 0; - } -}; -#endif - -/**************************************************************************** - * This class, appropriately enough, creates and recycles nsCString objects.. - ****************************************************************************/ - - - -#ifndef RICKG_TESTBED -class nsCStringRecycler { -public: - nsCStringRecycler() : mDeque(0) { - } - - ~nsCStringRecycler() { - nsCStringDeallocator theDeallocator; - mDeque.ForEach(theDeallocator); //now delete the strings - } - - void Recycle(nsCString* aString) { - mDeque.Push(aString); - } - - nsCString* CreateString(void){ - nsCString* result=(nsCString*)mDeque.Pop(); - if(!result) - result=new nsCString(); - return result; - } - nsDeque mDeque; -}; -static nsCStringRecycler& GetRecycler(void); - - -/** - * - * @update gess 01/04/99 - * @param - * @return - */ -nsCStringRecycler& GetRecycler(void){ - static nsCStringRecycler gCRecycler; - return gCRecycler; -} - -#endif - -/** - * Call this mehod when you're done - * @update gess 01/04/99 - * @param - * @return - */ -nsCString* nsCString::CreateString(void){ - nsCString* result=0; -#ifndef RICKG_TESTBED - result=GetRecycler().CreateString(); -#endif - return result; -} - -/** - * Call this mehod when you're done - * @update gess 01/04/99 - * @param - * @return - */ -void nsCString::Recycle(nsCString* aString){ -#ifndef RICKG_TESTBED - GetRecycler().Recycle(aString); -#endif -} - #if 0 /** diff --git a/mozilla/xpcom/string/obsolete/nsString.h b/mozilla/xpcom/string/obsolete/nsString.h index 1220ac752bc..5b1580f900f 100644 --- a/mozilla/xpcom/string/obsolete/nsString.h +++ b/mozilla/xpcom/string/obsolete/nsString.h @@ -246,14 +246,16 @@ public: /** * Creates an ISOLatin1 clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @return ptr to new isolatin1 string */ char* ToNewCString() const; /** * Creates a unicode clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @return ptr to new unicode string */ PRUnichar* ToNewUnicode() const; @@ -435,10 +437,6 @@ public: void DebugDump(void) const; - - static void Recycle(nsCString* aString); - static nsCString* CreateString(void); - private: // NOT TO BE IMPLEMENTED // these signatures help clients not accidentally call the wrong thing helped by C++ automatic integral promotion diff --git a/mozilla/xpcom/string/obsolete/nsString2.cpp b/mozilla/xpcom/string/obsolete/nsString2.cpp index c07c3aec703..0bd70072a25 100644 --- a/mozilla/xpcom/string/obsolete/nsString2.cpp +++ b/mozilla/xpcom/string/obsolete/nsString2.cpp @@ -582,7 +582,8 @@ nsString* nsString::ToNewString() const { /** * Creates an ascii clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @update gess 02/24/00 * @WARNING! Potential i18n issue here, since we're stepping down from 2byte chars to 1byte chars! * @return ptr to new ascii string @@ -599,7 +600,8 @@ char* nsString::ToNewCString() const { /** * Creates an UTF8 clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @update ftang 09/10/99 * @return ptr to new UTF8 string * http://www.cis.ohio-state.edu/htbin/rfc/rfc2279.html @@ -627,7 +629,8 @@ char* nsString::ToNewUTF8String() const { /** * Creates an ascii clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @update gess 02/24/00 * @return ptr to new ascii string */ @@ -1527,90 +1530,6 @@ PRBool nsString::IsDigit(PRUnichar aChar) { return PRBool((aChar >= '0') && (aChar <= '9')); } -#ifndef RICKG_TESTBED -/************************************************************** - Define the string deallocator class... - **************************************************************/ -class nsStringDeallocator: public nsDequeFunctor{ -public: - virtual void* operator()(void* anObject) { - nsString* aString= (nsString*)anObject; - if(aString){ - delete aString; - } - return 0; - } -}; - -/**************************************************************************** - * This class, appropriately enough, creates and recycles nsString objects.. - ****************************************************************************/ - -class nsStringRecycler { -public: - nsStringRecycler() : mDeque(0) { - } - - ~nsStringRecycler() { - nsStringDeallocator theDeallocator; - mDeque.ForEach(theDeallocator); //now delete the strings - } - - void Recycle(nsString* aString) { - mDeque.Push(aString); - } - - nsString* CreateString(void){ - nsString* result=(nsString*)mDeque.Pop(); - if(!result) - result=new nsString(); - return result; - } - nsDeque mDeque; -}; -static nsStringRecycler& GetRecycler(void); - -/** - * - * @update gess 01/04/99 - * @param - * @return - */ -nsStringRecycler& GetRecycler(void){ - static nsStringRecycler gRecycler; - return gRecycler; -} -#endif - - -/** - * Call this mehod when you're done - * @update gess 01/04/99 - * @param - * @return - */ -nsString* nsString::CreateString(void){ - nsString* result=0; -#ifndef RICKG_TESTBED - GetRecycler().CreateString(); -#endif - return result; -} - -/** - * Call this mehod when you're done - * @update gess 01/04/99 - * @param - * @return - */ -void nsString::Recycle(nsString* aString){ -#ifndef RICKG_TESTBED - GetRecycler().Recycle(aString); -#else - delete aString; -#endif -} - #if 0 /** diff --git a/mozilla/xpcom/string/obsolete/nsString2.h b/mozilla/xpcom/string/obsolete/nsString2.h index a5c9b65d6a6..b7e954fe179 100644 --- a/mozilla/xpcom/string/obsolete/nsString2.h +++ b/mozilla/xpcom/string/obsolete/nsString2.h @@ -276,21 +276,24 @@ public: /** * Creates an ISOLatin1 clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @return ptr to new isolatin1 string */ char* ToNewCString() const; /** * Creates an UTF8 clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @return ptr to new null-terminated UTF8 string */ char* ToNewUTF8String() const; /** * Creates a unicode clone of this string - * Note that calls to this method should be matched with calls to Recycle(). + * Note that calls to this method should be matched with calls to + * |nsMemory::Free|. * @return ptr to new unicode string */ PRUnichar* ToNewUnicode() const; @@ -506,9 +509,6 @@ public: */ static PRBool IsDigit(PRUnichar ch); - static void Recycle(nsString* aString); - static nsString* CreateString(void); - private: // NOT TO BE IMPLEMENTED // these signatures help clients not accidentally call the wrong thing helped by C++ automatic integral promotion