summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2010-11-25 11:48:11 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2010-11-25 11:48:11 +0000
commit76da5fa89ddef402f680ce222416fb4be17df89f (patch)
tree625be560d56e96571eab061db11e34322a4de7d2 /cpukit/score/include
parent2010-11-25 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-76da5fa89ddef402f680ce222416fb4be17df89f.tar.bz2
2010-11-25 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR 1711/cpukit * score/inline/rtems/score/chain.inl, score/src/chain.c: New functions _Chain_Immutable_head(), _Chain_Immutable_tail(), _Chain_Immutable_first(), and _Chain_Immutable_last(). The Chain_Control is now a union to avoid casts. The function _Chain_Is_empty() takes now a const pointer parameter.
Diffstat (limited to 'cpukit/score/include')
-rw-r--r--cpukit/score/include/rtems/score/chain.h28
1 files changed, 11 insertions, 17 deletions
diff --git a/cpukit/score/include/rtems/score/chain.h b/cpukit/score/include/rtems/score/chain.h
index 4d298b3cd2..187a466c90 100644
--- a/cpukit/score/include/rtems/score/chain.h
+++ b/cpukit/score/include/rtems/score/chain.h
@@ -83,30 +83,24 @@ struct Chain_Node_struct {
* manipulating the first and last elements on the chain.
* To accomplish this the @a Chain_Control structure is
* treated as two overlapping @ref Chain_Node structures.
- * The permanent head of the chain overlays a node structure on the
- * @a first and @a permanent_null fields. The permanent tail
- * of the chain overlays a node structure on the
- * @a permanent_null and @a last elements of the structure.
- *
*/
-typedef struct {
- /** This points to the first node on this chain. */
- Chain_Node *first;
- /** This field is always 0. */
- Chain_Node *permanent_null;
- /** This points to the last node on this chain. */
- Chain_Node *last;
+typedef union {
+ struct {
+ Chain_Node Node;
+ Chain_Node *fill;
+ } Head;
+
+ struct {
+ Chain_Node *fill;
+ Chain_Node Node;
+ } Tail;
} Chain_Control;
/**
* @brief Chain initializer for an empty chain with designator @a name.
*/
#define CHAIN_INITIALIZER_EMPTY(name) \
- { \
- (Chain_Node *) &(name).permanent_null, \
- NULL, \
- (Chain_Node *) &(name) \
- }
+ { { { &(name).Tail.Node, NULL }, &(name).Head.Node } }
/**
* @brief Chain definition for an empty chain with designator @a name.