fixed bug in nsString; added recycler to nsString2

git-svn-id: svn://10.0.0.236/trunk@24808 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg%netscape.com
1999-03-23 07:26:27 +00:00
parent 6f8559e7b3
commit a0d40e6afd
12 changed files with 256 additions and 0 deletions

View File

@@ -28,6 +28,7 @@
#include "nsISizeOfHandler.h"
#include "prprf.h"
#include "prdtoa.h"
#include "nsDeque.h"
#include "nsUnicharUtilCIID.h"
#include "nsIServiceManager.h"
@@ -1567,6 +1568,64 @@ PRBool nsString2::IsDigit(PRUnichar aChar) {
}
/****************************************************************************
* This class, appropriately enough, creates and recycles nsString2 objects..
****************************************************************************/
#if 0
class nsStringRecycler {
public:
nsStringRecycler() : mDeque(0) {
}
void Recycle(nsString2* aString) {
mDeque.Push(aString);
}
nsString2* NewString(eCharSize aCharSize){
nsString2* result=(nsString2*)mDeque.Pop();
if(!result)
result=new nsString2(aCharSize);
return result;
}
nsDeque mDeque;
};
/**
*
* @update gess 01/04/99
* @param
* @return
*/
nsStringRecycler& GetRecycler(void){
static nsStringRecycler gRecycler;
return gRecycler;
}
/**
* Call this mehod when you're done
* @update gess 01/04/99
* @param
* @return
*/
nsString2* nsString2::NewString(eCharSize aCharSize){
nsString2* result=GetRecycler().NewString(aCharSize);
return result;
}
/**
* Call this mehod when you're done
* @update gess 01/04/99
* @param
* @return
*/
void nsString2::Recycle(nsString2* aString){
GetRecycler().Recycle(aString);
}
#endif
/**
*
* @update gess 01/04/99