windows-nt/Source/XPSP1/NT/shell/osshell/dskquota/common/alloc.cpp

44 lines
602 B
C++
Raw Normal View History

2020-09-26 03:20:57 -05:00
#include "pch.h"
#pragma hdrstop
#include "alloc.h"
#include "except.h"
void * __cdecl operator new(
size_t size
)
{
void *pv = LocalAlloc(LMEM_FIXED, size);
if (NULL == pv)
throw CAllocException();
return pv;
}
void* __cdecl operator new[] (size_t size)
{
void *pv = LocalAlloc(LMEM_FIXED, size);
if (NULL == pv)
throw CAllocException();
return pv;
}
void __cdecl operator delete(
void *ptr
)
{
if (NULL != ptr)
LocalFree(ptr);
}
void __cdecl operator delete[] (void* ptr)
{
if (NULL != ptr)
LocalFree(ptr);
}