Added GetGlobalAllocator.

This commit is contained in:
warren%netscape.com 1999-08-10 19:54:17 +00:00
parent 8f5b13ed87
commit 0d2bbb1e6a
2 changed files with 10 additions and 1 deletions

View File

@ -165,7 +165,15 @@ void* nsAllocator::Clone(const void* ptr, PRUint32 size)
void* p = mAllocator->Alloc(size);
if(p) memcpy(p, ptr, size);
return p;
}
}
NS_EXPORT nsIAllocator*
nsAllocator::GetGlobalAllocator()
{
if(!EnsureAllocator()) return nsnull;
NS_ADDREF(mAllocator);
return mAllocator;
}
// private:

View File

@ -95,6 +95,7 @@ public:
static NS_EXPORT void Free(void* ptr);
static NS_EXPORT void HeapMinimize();
static NS_EXPORT void* Clone(const void* ptr, PRUint32 size);
static NS_EXPORT nsIAllocator* GetGlobalAllocator();
private:
nsAllocator(); // not implemented
static PRBool EnsureAllocator() {return mAllocator || FetchAllocator();}