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.

51 lines
1.2 KiB

  1. #include <fusenetincludes.h>
  2. #include <tlist.h>
  3. //-----------------------------------------------------------------------------
  4. // slist::insert
  5. // Insert single link element at head.
  6. //-----------------------------------------------------------------------------
  7. void slist::insert(slink *p)
  8. {
  9. if (last)
  10. p->next = last->next;
  11. else
  12. last = p;
  13. last->next = p;
  14. }
  15. //-----------------------------------------------------------------------------
  16. // slist::append
  17. // Append single link element at tail.
  18. //-----------------------------------------------------------------------------
  19. void slist::append(slink* p)
  20. {
  21. if (last)
  22. {
  23. p->next = last->next;
  24. last = last->next = p;
  25. }
  26. else
  27. last = p->next = p;
  28. }
  29. //-----------------------------------------------------------------------------
  30. // slist::get
  31. // Return next single link element ptr.
  32. //-----------------------------------------------------------------------------
  33. slink* slist::get()
  34. {
  35. if (last == NULL)
  36. return NULL;
  37. slink* p = last->next;
  38. if (p == last)
  39. last = NULL;
  40. else
  41. last->next = p->next;
  42. return p;
  43. }