Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
800 B

//
// plex.cpp
//
// CPlex
//
#include "private.h"
#include "template.h"
/////////////////////////////////////////////////////////////////////////////
// CPlex
CPlex* PASCAL
CPlex::Create(
CPlex*& pHead,
UINT nMax,
UINT cbElement
)
{
ASSERT(nMax > 0 && cbElement > 0);
CPlex* p = (CPlex*) new BYTE[sizeof(CPlex) + nMax * cbElement];
// may throw exception
if ( p == NULL )
return NULL;
p->pNext = pHead;
pHead = p; // change head (adds in reverse order for simplicity)
return p;
}
void
CPlex::FreeDataChain(
)
{
CPlex* p = this;
while (p != NULL) {
BYTE* bytes = (BYTE*) p;
CPlex* pNext = p->pNext;
delete[] bytes;
p = pNext;
}
}