X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=mware%2Flist.h;h=5b0accde7d911113d3afcb2be2f3aeb582642946;hb=f3acac1f7e1e5d3826de4638fed4023183140e7a;hp=4762c3b2ae81cfd77942ea61de0623151b659da0;hpb=82576456c4e4a89ab5376d72375c28ad3adbd35b;p=bertos.git diff --git a/mware/list.h b/mware/list.h index 4762c3b2..5b0accde 100755 --- a/mware/list.h +++ b/mware/list.h @@ -15,6 +15,12 @@ /*#* *#* $Log$ + *#* Revision 1.13 2005/04/11 19:10:28 bernie + *#* Include top-level headers from cfg/ subdir. + *#* + *#* Revision 1.12 2005/01/22 04:21:32 bernie + *#* Add integrity checks. + *#* *#* Revision 1.11 2004/12/31 16:44:11 bernie *#* list_remHead(), list_remTail(): Name like normal functions. *#* @@ -53,7 +59,7 @@ #ifndef MWARE_LIST_H #define MWARE_LIST_H -#include // INLINE +#include // INLINE /*! * This structure represents a node for bidirectional lists. @@ -118,6 +124,26 @@ typedef struct _List (l)->tail = (Node *)(&(l)->head); \ } while (0) +/* Make sure that a list is valid (it was initialized and is not corrupted) */ +#ifdef _DEBUG + #define LIST_ASSERT_VALID(l) \ + do { \ + Node *n, *pred; \ + ASSERT((l)->head != NULL); \ + ASSERT((l)->null == NULL); \ + ASSERT((l)->tail != NULL); \ + pred = (Node *)(&(l)->head); \ + FOREACHNODE(n, l) \ + { \ + ASSERT(n->pred == pred); \ + pred = n; \ + } \ + ASSERT(n == (Node *)(&(l)->null)); \ + } while (0) +#else + #define LIST_ASSERT_VALID(l) do {} while (0) +#endif + /*! Add node to list head. */ #define ADDHEAD(l,n) \ do { \