|
|
1.1 root 1: // This is a part of the Microsoft Foundation Classes C++ library.
2: // Copyright (C) 1992 Microsoft Corporation
3: // All rights reserved.
4: //
5: // This source code is only intended as a supplement to the
6: // Microsoft Foundation Classes Reference and Microsoft
7: // QuickHelp documentation provided with the library.
8: // See these sources for detailed information regarding the
9: // Microsoft Foundation Classes product.
10:
11: #include "afx.h"
12: #pragma hdrstop
13:
14: #include "plex.h"
15:
16: // Collection support
17: #ifdef AFX_COLL_SEG
18: #pragma code_seg(AFX_COLL_SEG)
19: #endif
20:
21: #ifdef _DEBUG
22: #undef THIS_FILE
23: static char BASED_CODE THIS_FILE[] = __FILE__;
24: #endif
25:
26: #define new DEBUG_NEW
27:
28: CPlex* CPlex::Create(CPlex*& pHead, UINT nMax, UINT cbElement)
29: {
30: ASSERT(nMax > 0 && cbElement > 0);
31: CPlex* p = (CPlex*) new BYTE[sizeof(CPlex) + nMax * cbElement];
32: // may throw exception
33: p->nMax = nMax;
34: p->nCur = 0;
35: p->pNext = pHead;
36: pHead = p; // change head (adds in reverse order for simplicity)
37: return p;
38: }
39:
40: void CPlex::FreeDataChain() // free this one and links
41: {
42: CPlex* p = this;
43: while (p != NULL)
44: {
45: BYTE* bytes = (BYTE*) p;
46: CPlex* pNext = p->pNext;
47: delete bytes;
48: p = pNext;
49: }
50: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.