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.

45 lines
1.1 KiB

  1. // This was a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) Microsoft Corporation, 1992 - 1999
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. #include "stdafx.h"
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CPlex
  17. CPlex* PASCAL CPlex::Create(CPlex*& pHead, UINT nMax, UINT cbElement)
  18. {
  19. ASSERT(nMax > 0 && cbElement > 0);
  20. CPlex* p = (CPlex*) new BYTE[sizeof(CPlex) + nMax * cbElement];
  21. if (p == NULL)
  22. return NULL;
  23. p->pNext = pHead;
  24. pHead = p; // change head (adds in reverse order for simplicity)
  25. return p;
  26. }
  27. void CPlex::FreeDataChain() // free this one and links
  28. {
  29. CPlex* p = this;
  30. while (p != NULL)
  31. {
  32. BYTE* bytes = (BYTE*) p;
  33. CPlex* pNext = p->pNext;
  34. delete[] bytes;
  35. p = pNext;
  36. }
  37. }