bug #73297, r=shaver, sr=darin. Give string buffers an allocator hook to tie into js et al

git-svn-id: svn://10.0.0.236/trunk@90352 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scc%mozilla.org
2001-03-25 01:14:26 +00:00
parent 0dd79e0251
commit 3b6f8d16d6
4 changed files with 286 additions and 12 deletions

View File

@@ -27,6 +27,42 @@
#include "nsCRT.h"
/**
* this allocator definition, and the global functions to access it need to move
* to their own file
*/
template <class CharT>
class XPCOM_StringAllocator
: public nsStringAllocator<CharT>
{
public:
virtual void Deallocate( CharT* ) const;
};
template <class CharT>
void
XPCOM_StringAllocator<CharT>::Deallocate( CharT* aBuffer ) const
{
nsMemory::Free(aBuffer);
}
NS_COM
nsStringAllocator<char>&
StringAllocator_char()
{
static XPCOM_StringAllocator<char> sStringAllocator_char;
return sStringAllocator_char;
}
NS_COM
nsStringAllocator<PRUnichar>&
StringAllocator_wchar_t()
{
static XPCOM_StringAllocator<PRUnichar> sStringAllocator_wchar_t;
return sStringAllocator_wchar_t;
}
template <class CharT> class CalculateLength
{
public: