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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user