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.

40 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. #include <provcoll.h>
  14. #include "provmt.h"
  15. #include "plex.h"
  16. CPlex* CPlex::Create(CPlex*& pHead, UINT nMax, UINT cbElement)
  17. {
  18. CPlex* p = (CPlex*) new BYTE[sizeof(CPlex) + nMax * cbElement];
  19. // may throw exception
  20. p->nMax = nMax;
  21. p->nCur = 0;
  22. p->pNext = pHead;
  23. pHead = p; // change head (adds in reverse order for simplicity)
  24. return p;
  25. }
  26. void CPlex::FreeDataChain() // free this one and links
  27. {
  28. CPlex* p = this;
  29. while (p != NULL)
  30. {
  31. BYTE* bytes = (BYTE*) p;
  32. CPlex* pNext = p->pNext;
  33. delete bytes;
  34. p = pNext;
  35. }
  36. }