#define MWARE_LIST_H
#include <cfg/compiler.h> /* INLINE */
-#include <cfg/debug.h> /* ASSERT() */
+#include <cfg/debug.h> /* ASSERT_VALID_PTR() */
/**
* This structure represents a node for bidirectional lists.
/** Add node to list head. */
#define ADDHEAD(l,n) \
do { \
- ASSERT(l); \
- ASSERT(n); \
+ ASSERT_VALID_PTR(l); \
+ ASSERT_VALID_PTR(n); \
(n)->succ = (l)->head.succ; \
(n)->pred = (l)->head.succ->pred; \
(n)->succ->pred = (n); \
/** Add node to list tail. */
#define ADDTAIL(l,n) \
do { \
- ASSERT(l); \
- ASSERT(n); \
+ ASSERT_VALID_PTR(l); \
+ ASSERT_VALID_PTR(n); \
(n)->succ = &(l)->tail; \
(n)->pred = (l)->tail.pred; \
(n)->pred->succ = (n); \
*/
#define INSERT_BEFORE(n,ln) \
do { \
+ ASSERT_VALID_PTR(n); \
+ ASSERT_VALID_PTR(ln); \
(n)->succ = (ln); \
(n)->pred = (ln)->pred; \
(ln)->pred->succ = (n); \
*/
#define REMOVE(n) \
do { \
+ ASSERT_VALID_PTR(n); \
(n)->pred->succ = (n)->succ; \
(n)->succ->pred = (n)->pred; \
INVALIDATE_NODE(n); \
#define LIST_ENQUEUE(list, node) \
do { \
PriNode *ln; \
+ ASSERT_VALID_PTR(list); \
+ ASSERT_VALID_PTR(node); \
FOREACH_NODE(ln, (list)) \
if (ln->pri < (node)->pri) \
break; \
{
Node *n;
+ ASSERT_VALID_PTR(l);
+
if (LIST_EMPTY(l))
return (Node *)0;
{
Node *n;
+ ASSERT_VALID_PTR(l);
+
if (LIST_EMPTY(l))
- return (Node *)0;
+ return NULL;
n = l->tail.pred; /* Get last node. */
l->tail.pred = n->pred; /* Link list tail to second last node. */