Source code of Windows XP (NT5)
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.

96 lines
2.0 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. #include "debug.hxx"
  18. //+-------------------------------------------------------------------------
  19. //
  20. // Member: CDLink::LinkAfter
  21. //
  22. // Purpose: Links this after dlPrev and before dlPrev->_dlNext
  23. //
  24. // Returns: this
  25. //
  26. // Note: None.
  27. //
  28. //--------------------------------------------------------------------------
  29. VOID CDLink::LinkAfter(CDLink * dlPrev)
  30. {
  31. _dlPrev = dlPrev;
  32. if(dlPrev != NULL)
  33. {
  34. _dlNext = dlPrev->_dlNext;
  35. dlPrev->_dlNext = this;
  36. if(_dlNext != NULL) {
  37. _dlNext->_dlPrev = this;
  38. }
  39. }
  40. else
  41. {
  42. _dlNext = NULL;
  43. }
  44. }
  45. //+-------------------------------------------------------------------------
  46. //
  47. // Member: CDLink::LinkBefore
  48. //
  49. // Purpose: Links this Before dlNext and after dlNext->_dlPrev
  50. //
  51. // Returns: this
  52. //
  53. //--------------------------------------------------------------------------
  54. VOID CDLink::LinkBefore(CDLink * dlNext)
  55. {
  56. _dlNext = dlNext;
  57. if(dlNext != NULL)
  58. {
  59. _dlPrev = dlNext->_dlPrev;
  60. dlNext->_dlPrev = this;
  61. if(_dlPrev != NULL) {
  62. _dlPrev->_dlNext = this;
  63. }
  64. }
  65. else
  66. {
  67. _dlPrev = NULL;
  68. }
  69. }
  70. //+-------------------------------------------------------------------------
  71. //
  72. // Member: CDLink::Unlink()
  73. //
  74. // Purpose: Removes this from double linked list
  75. //
  76. // Returns: this
  77. //
  78. //--------------------------------------------------------------------------
  79. VOID CDLink::UnLink()
  80. {
  81. if(_dlNext != NULL) {
  82. _dlNext->_dlPrev = _dlPrev;
  83. }
  84. if(_dlPrev != NULL) {
  85. _dlPrev->_dlNext = _dlNext;
  86. }
  87. _dlNext = _dlPrev = NULL;
  88. }