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.

86 lines
1.3 KiB

  1. //*************************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation 1998
  4. // All rights reserved
  5. //
  6. // list.cxx
  7. //
  8. //*************************************************************
  9. #include "common.hxx"
  10. //
  11. // CListItem
  12. //
  13. void
  14. CListItem::Remove()
  15. {
  16. _pPrev->_pNext = _pNext;
  17. _pNext->_pPrev = _pPrev;
  18. }
  19. void
  20. CListItem::InsertBefore(
  21. IN CListItem * pItem
  22. )
  23. {
  24. pItem->_pPrev = _pPrev;
  25. pItem->_pNext = this;
  26. _pPrev->_pNext = pItem;
  27. _pPrev = pItem;
  28. }
  29. //
  30. // CList
  31. //
  32. CList::CList() :
  33. _pCurrent(NULL),
  34. _pCurrentSave(NULL)
  35. {
  36. _Head._pNext = &_Head;
  37. _Head._pPrev = &_Head;
  38. }
  39. //
  40. // CList::InsertLIFO()
  41. //
  42. // Inserts the given item at the front of the list. Last in first out semantics.
  43. //
  44. void
  45. CList::InsertLIFO(
  46. IN CListItem * pItem
  47. )
  48. {
  49. pItem->_pNext = _Head._pNext;
  50. pItem->_pPrev = &_Head;
  51. _Head._pNext->_pPrev = pItem;
  52. _Head._pNext = pItem;
  53. }
  54. //
  55. // CList::InsertFIFO()
  56. //
  57. // Inserts the given item at the end of the list. First in first out semantics.
  58. //
  59. void
  60. CList::InsertFIFO(
  61. IN CListItem * pItem
  62. )
  63. {
  64. pItem->_pNext = &_Head;
  65. pItem->_pPrev = _Head._pPrev;
  66. _Head._pPrev->_pNext = pItem;
  67. _Head._pPrev = pItem;
  68. }