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.

79 lines
1.1 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. BILINK.H
  5. Abstract:
  6. Management for doubly linked lists
  7. Author:
  8. George Joy
  9. Environment:
  10. 32-bit 'C'
  11. Revision History:
  12. --*/// BILINK.H
  13. #ifndef _BILINK_
  14. #define _BILINK_
  15. #if !defined(offsetof)
  16. #define offsetof(type, field) ((int)(&((type *)0)->field))
  17. #endif
  18. typedef struct BILINK {
  19. struct BILINK *next;
  20. struct BILINK *prev;
  21. } BILINK;
  22. /* XLATOFF */
  23. #define EMPTY_BILINK(_pBilink) ((_pBilink)->next==(_pBilink))
  24. #ifdef DEBUG
  25. #define ASSERT_EMPTY_BILINK(_b) ASSERT((_b)->next==(_b))
  26. #else
  27. #define ASSERT_EMPTY_BILINK(_b)
  28. #endif
  29. // This only works for BILINKS that are the first item in a structure.
  30. #define BilinkToList( _pBilink ) \
  31. (_pBilink)->prev->next=NULL;
  32. #define InitBilink( _pBilink ) \
  33. (_pBilink)->prev=(_pBilink)->next=(_pBilink);
  34. #ifdef DEBUG
  35. int FindObject(
  36. BILINK *link,
  37. BILINK *list
  38. );
  39. #endif
  40. void InsertAfter(
  41. BILINK *in,
  42. BILINK *after
  43. );
  44. void InsertBefore(
  45. BILINK *in,
  46. BILINK *before
  47. );
  48. void Delete(
  49. BILINK *p
  50. );
  51. /* XLATON */
  52. #endif