mirror of https://github.com/tongzx/nt5src
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.
37 lines
928 B
37 lines
928 B
//-----------------------------------------------------------------------------
|
|
// File: collections.cpp
|
|
//
|
|
// Desc: Contains all container templates used by the UI.
|
|
//
|
|
// Copyright (C) 1999-2000 Microsoft Corporation. All Rights Reserved.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#include "common.h"
|
|
|
|
|
|
BOOL AfxIsValidAddress( const void* lp, UINT nBytes, BOOL bReadWrite)
|
|
{
|
|
return lp != NULL;
|
|
}
|
|
|
|
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
|
|
p->pNext = pHead;
|
|
pHead = p; // change head (adds in reverse order for simplicity)
|
|
return p;
|
|
}
|
|
|
|
void CPlex::FreeDataChain() // free this one and links
|
|
{
|
|
CPlex* p = this;
|
|
while (p != NULL)
|
|
{
|
|
BYTE* bytes = (BYTE*) p;
|
|
CPlex* pNext = p->pNext;
|
|
delete[] bytes;
|
|
p = pNext;
|
|
}
|
|
}
|