projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix naming conventions.
[bertos.git]
/
mware
/
list.h
diff --git
a/mware/list.h
b/mware/list.h
index 8de285905f22518bffd083ea3a9a194fe2cfc986..8d89b4d61736748f77b4230c6631e1ec30550b3b 100755
(executable)
--- a/
mware/list.h
+++ b/
mware/list.h
@@
-15,6
+15,12
@@
/*#*
*#* $Log$
/*#*
*#* $Log$
+ *#* Revision 1.19 2006/03/20 17:50:29 bernie
+ *#* Fix typo.
+ *#*
+ *#* Revision 1.18 2006/02/27 22:40:21 bernie
+ *#* Add support for poor pre-C99 compilers.
+ *#*
*#* Revision 1.17 2006/02/24 01:18:34 bernie
*#* LIST_ENQUEUE(): New macro; Remove obsolete names.
*#*
*#* Revision 1.17 2006/02/24 01:18:34 bernie
*#* LIST_ENQUEUE(): New macro; Remove obsolete names.
*#*
@@
-134,7
+140,7
@@
typedef struct _PriNode
*
* LIST_INIT(&foo_list);
* ADDHEAD(&foo_list, &foo1);
*
* LIST_INIT(&foo_list);
* ADDHEAD(&foo_list, &foo1);
- * INSERTBEFORE(&foo_list, &foo2);
+ * INSERT
_
BEFORE(&foo_list, &foo2);
* FOREACH_NODE(fp, &foo_list)
* fp->a = 10;
* }
* FOREACH_NODE(fp, &foo_list)
* fp->a = 10;
* }
@@
-173,6
+179,13
@@
typedef struct _PriNode
*/
#define LIST_TAIL(l) ((l)->tail.pred)
*/
#define LIST_TAIL(l) ((l)->tail.pred)
+// TODO: move in compiler.h
+#if COMPILER_TYPEOF
+ #define TYPEOF_OR_VOIDPTR(type) typeof(type)
+#else
+ #define TYPEOF_OR_VOIDPTR(type) void *
+#endif
+
/*!
* Iterate over all nodes in a list.
*
/*!
* Iterate over all nodes in a list.
*
@@
-182,9
+195,9
@@
typedef struct _PriNode
*/
#define FOREACH_NODE(n, l) \
for( \
*/
#define FOREACH_NODE(n, l) \
for( \
- (n) = (
typeof
(n))LIST_HEAD(l); \
+ (n) = (
TYPEOF_OR_VOIDPTR
(n))LIST_HEAD(l); \
((Node *)(n))->succ; \
((Node *)(n))->succ; \
- (n) = (
typeof
(n))(((Node *)(n))->succ) \
+ (n) = (
TYPEOF_OR_VOIDPTR
(n))(((Node *)(n))->succ) \
)
/*!
)
/*!
@@
-196,18
+209,18
@@
typedef struct _PriNode
*/
#define REVERSE_FOREACH_NODE(n, l) \
for( \
*/
#define REVERSE_FOREACH_NODE(n, l) \
for( \
- (n) = (
typeof
(n))LIST_TAIL(l); \
+ (n) = (
TYPEOF_OR_VOIDPTR
(n))LIST_TAIL(l); \
((Node *)(n))->pred; \
((Node *)(n))->pred; \
- (n) = (
typeof
(n))(((Node *)(n))->pred) \
+ (n) = (
TYPEOF_OR_VOIDPTR
(n))(((Node *)(n))->pred) \
)
/*! Initialize a list. */
#define LIST_INIT(l) \
do { \
)
/*! Initialize a list. */
#define LIST_INIT(l) \
do { \
- (l)->head.succ = (
typeof
((l)->head.succ)) &(l)->tail; \
+ (l)->head.succ = (
TYPEOF_OR_VOIDPTR
((l)->head.succ)) &(l)->tail; \
(l)->head.pred = NULL; \
(l)->tail.succ = NULL; \
(l)->head.pred = NULL; \
(l)->tail.succ = NULL; \
- (l)->tail.pred = (
typeof
((l)->tail.pred)) &(l)->head; \
+ (l)->tail.pred = (
TYPEOF_OR_VOIDPTR
((l)->tail.pred)) &(l)->head; \
} while (0)
#ifdef _DEBUG
} while (0)
#ifdef _DEBUG