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.

38 lines
1.1 KiB

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (c) 1992-2001 Microsoft Corporation, All Rights Reserved
  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 and/or WinHelp documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. #include "precomp.h"
  11. #include <provexpt.h>
  12. #include "plex.h"
  13. CPlex* CPlex::Create(CPlex*& pHead, UINT nMax, UINT cbElement)
  14. {
  15. CPlex* p = (CPlex*) new BYTE[sizeof(CPlex) + nMax * cbElement];
  16. // may throw exception
  17. p->nMax = nMax;
  18. p->nCur = 0;
  19. p->pNext = pHead;
  20. pHead = p; // change head (adds in reverse order for simplicity)
  21. return p;
  22. }
  23. void CPlex::FreeDataChain() // free this one and links
  24. {
  25. CPlex* p = this;
  26. while (p != NULL)
  27. {
  28. BYTE* bytes = (BYTE*) p;
  29. CPlex* pNext = p->pNext;
  30. delete bytes;
  31. p = pNext;
  32. }
  33. }