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.

95 lines
2.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File: cdlink.cxx
  7. //
  8. // Contents:
  9. //
  10. // Classes: CDlink
  11. //
  12. // History: 16-Oct-91 KevinRo Created
  13. //
  14. //--------------------------------------------------------------------------
  15. #include "..\pch\headers.hxx"
  16. #pragma hdrstop
  17. //+-------------------------------------------------------------------------
  18. //
  19. // Member: CDLink::LinkAfter
  20. //
  21. // Purpose: Links this after dlPrev and before dlPrev->_dlNext
  22. //
  23. // Returns: this
  24. //
  25. // Note: None.
  26. //
  27. //--------------------------------------------------------------------------
  28. VOID CDLink::LinkAfter(CDLink * dlPrev)
  29. {
  30. _dlPrev = dlPrev;
  31. if(dlPrev != NULL)
  32. {
  33. _dlNext = dlPrev->_dlNext;
  34. dlPrev->_dlNext = this;
  35. if(_dlNext != NULL) {
  36. _dlNext->_dlPrev = this;
  37. }
  38. }
  39. else
  40. {
  41. _dlNext = NULL;
  42. }
  43. }
  44. //+-------------------------------------------------------------------------
  45. //
  46. // Member: CDLink::LinkBefore
  47. //
  48. // Purpose: Links this Before dlNext and after dlNext->_dlPrev
  49. //
  50. // Returns: this
  51. //
  52. //--------------------------------------------------------------------------
  53. VOID CDLink::LinkBefore(CDLink * dlNext)
  54. {
  55. _dlNext = dlNext;
  56. if(dlNext != NULL)
  57. {
  58. _dlPrev = dlNext->_dlPrev;
  59. dlNext->_dlPrev = this;
  60. if(_dlPrev != NULL) {
  61. _dlPrev->_dlNext = this;
  62. }
  63. }
  64. else
  65. {
  66. _dlPrev = NULL;
  67. }
  68. }
  69. //+-------------------------------------------------------------------------
  70. //
  71. // Member: CDLink::Unlink()
  72. //
  73. // Purpose: Removes this from double linked list
  74. //
  75. // Returns: this
  76. //
  77. //--------------------------------------------------------------------------
  78. VOID CDLink::UnLink()
  79. {
  80. if(_dlNext != NULL) {
  81. _dlNext->_dlPrev = _dlPrev;
  82. }
  83. if(_dlPrev != NULL) {
  84. _dlPrev->_dlNext = _dlNext;
  85. }
  86. _dlNext = _dlPrev = NULL;
  87. }