<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2010-11-25)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>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.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2656&r2=text&tr2=1.2657&diff_format=h">M</a></td><td width='1%'>1.2657</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/include/rtems/score/chain.h.diff?r1=text&tr1=1.25&r2=text&tr2=1.26&diff_format=h">M</a></td><td width='1%'>1.26</td><td width='100%'>cpukit/score/include/rtems/score/chain.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/inline/rtems/score/chain.inl.diff?r1=text&tr1=1.22&r2=text&tr2=1.23&diff_format=h">M</a></td><td width='1%'>1.23</td><td width='100%'>cpukit/score/inline/rtems/score/chain.inl</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2656 rtems/cpukit/ChangeLog:1.2657
--- rtems/cpukit/ChangeLog:1.2656       Thu Nov 25 03:27:05 2010
+++ rtems/cpukit/ChangeLog      Thu Nov 25 05:48:10 2010
</font><font color='#997700'>@@ -1,5 +1,14 @@
</font> 2010-11-25        Sebastian Huber <sebastian.huber@embedded-brains.de>
 
<font color='#000088'>+   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.
+
+2010-11-25     Sebastian Huber <sebastian.huber@embedded-brains.de>
+
</font>   * libfs/src/dosfs/fat_file.c, libfs/src/imfs/imfs_debug.c,
        libfs/src/imfs/imfs_directory.c, libfs/src/imfs/imfs_getchild.c,
        posix/src/killinfo.c, score/inline/rtems/score/schedulerpriority.inl,

<font color='#006600'>diff -u rtems/cpukit/score/include/rtems/score/chain.h:1.25 rtems/cpukit/score/include/rtems/score/chain.h:1.26
--- rtems/cpukit/score/include/rtems/score/chain.h:1.25 Mon Aug 23 11:10:53 2010
+++ rtems/cpukit/score/include/rtems/score/chain.h      Thu Nov 25 05:48:11 2010
</font><font color='#997700'>@@ -83,30 +83,24 @@
</font>  *   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.
<font color='#880000'>- *   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.
- *
</font>  */
<font color='#880000'>-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;
</font><font color='#000088'>+typedef union {
+  struct {
+    Chain_Node Node;
+    Chain_Node *fill;
+  } Head;
+
+  struct {
+    Chain_Node *fill;
+    Chain_Node Node;
+  } Tail;
</font> } Chain_Control;
 
 /**
  *  @brief Chain initializer for an empty chain with designator @a name.
  */
 #define CHAIN_INITIALIZER_EMPTY(name) \
<font color='#880000'>-  { \
-    (Chain_Node *) &(name).permanent_null, \
-    NULL, \
-    (Chain_Node *) &(name) \
-  }
</font><font color='#000088'>+  { { { &(name).Tail.Node, NULL }, &(name).Head.Node } }
</font> 
 /**
  *  @brief Chain definition for an empty chain with designator @a name.

<font color='#006600'>diff -u rtems/cpukit/score/inline/rtems/score/chain.inl:1.22 rtems/cpukit/score/inline/rtems/score/chain.inl:1.23
--- rtems/cpukit/score/inline/rtems/score/chain.inl:1.22        Mon Aug 23 11:10:53 2010
+++ rtems/cpukit/score/inline/rtems/score/chain.inl     Thu Nov 25 05:48:11 2010
</font><font color='#997700'>@@ -122,7 +122,22 @@
</font>   Chain_Control *the_chain
 )
 {
<font color='#880000'>-   return (Chain_Node *) the_chain;
</font><font color='#000088'>+  return &the_chain->Head.Node;
+}
+
+/** @brief Return pointer to immutable Chain Head
+ *
+ *  This function returns a pointer to the head node on the chain.
+ *
+ *  @param[in] the_chain is the chain to be operated upon.
+ *
+ *  @return This method returns the permanent head node of the chain.
+ */
+RTEMS_INLINE_ROUTINE const Chain_Node *_Chain_Immutable_head(
+  const Chain_Control *the_chain
+)
+{
+  return &the_chain->Head.Node;
</font> }
 
 /** @brief Return pointer to Chain Tail
<font color='#997700'>@@ -137,7 +152,22 @@
</font>   Chain_Control *the_chain
 )
 {
<font color='#880000'>-   return (Chain_Node *) &the_chain->permanent_null;
</font><font color='#000088'>+  return &the_chain->Tail.Node;
+}
+
+/** @brief Return pointer to immutable Chain Tail
+ *
+ *  This function returns a pointer to the last node on the chain.
+ *
+ *  @param[in] the_chain is the chain to be operated upon.
+ *
+ *  @return This method returns the permanent tail node of the chain.
+ */
+RTEMS_INLINE_ROUTINE const Chain_Node *_Chain_Immutable_tail(
+  const Chain_Control *the_chain
+)
+{
+  return &the_chain->Tail.Node;
</font> }
 
 /** @brief Return pointer to Chain's First node
<font color='#997700'>@@ -153,7 +183,23 @@
</font>   Chain_Control *the_chain
 )
 {
<font color='#880000'>-  return the_chain->first;
</font><font color='#000088'>+  return _Chain_Head( the_chain )->next;
+}
+
+/** @brief Return pointer to immutable Chain's First node
+ *
+ *  This function returns a pointer to the first node on the chain after the
+ *  head.
+ *
+ *  @param[in] the_chain is the chain to be operated upon.
+ *
+ *  @return This method returns the first node of the chain.
+ */
+RTEMS_INLINE_ROUTINE const Chain_Node *_Chain_Immutable_first(
+  const Chain_Control *the_chain
+)
+{
+  return _Chain_Immutable_head( the_chain )->next;
</font> }
 
 /** @brief Return pointer to Chain's Last node
<font color='#997700'>@@ -169,7 +215,23 @@
</font>   Chain_Control *the_chain
 )
 {
<font color='#880000'>-  return the_chain->last;
</font><font color='#000088'>+  return _Chain_Tail( the_chain )->previous;
+}
+
+/** @brief Return pointer to immutable Chain's Last node
+ *
+ *  This function returns a pointer to the last node on the chain just before
+ *  the tail.
+ *
+ *  @param[in] the_chain is the chain to be operated upon.
+ *
+ *  @return This method returns the last node of the chain.
+ */
+RTEMS_INLINE_ROUTINE const Chain_Node *_Chain_Immutable_last(
+  const Chain_Control *the_chain
+)
+{
+  return _Chain_Immutable_tail( the_chain )->previous;
</font> }
 
 /** @brief Return pointer the next node from this node
<font color='#997700'>@@ -213,10 +275,11 @@
</font>  *  false otherwise.
  */
 RTEMS_INLINE_ROUTINE bool _Chain_Is_empty(
<font color='#880000'>-  Chain_Control *the_chain
</font><font color='#000088'>+  const Chain_Control *the_chain
</font> )
 {
<font color='#880000'>-  return (the_chain->first == _Chain_Tail(the_chain));
</font><font color='#000088'>+  return _Chain_Immutable_first( the_chain )
+    == _Chain_Immutable_tail( the_chain );
</font> }
 
 /** @brief Is this the First Node on the Chain
<font color='#997700'>@@ -268,7 +331,8 @@
</font>   const Chain_Control *the_chain
 )
 {
<font color='#880000'>-  return (the_chain->first == the_chain->last);
</font><font color='#000088'>+  return _Chain_Immutable_first( the_chain )
+    == _Chain_Immutable_last( the_chain );
</font> }
 
 /** @brief Is this Node the Chain Head
<font color='#997700'>@@ -287,7 +351,7 @@
</font>   const Chain_Node    *the_node
 )
 {
<font color='#880000'>-   return (the_node == _Chain_Head(the_chain));
</font><font color='#000088'>+  return (the_node == _Chain_Head(the_chain));
</font> }
 
 /** @brief Is this Node the Chail Tail
<font color='#997700'>@@ -303,7 +367,7 @@
</font>   const Chain_Node    *the_node
 )
 {
<font color='#880000'>-   return (the_node == _Chain_Tail(the_chain));
</font><font color='#000088'>+  return (the_node == _Chain_Tail(the_chain));
</font> }
 
 /** @brief Initialize this Chain as Empty
<font color='#997700'>@@ -316,9 +380,12 @@
</font>   Chain_Control *the_chain
 )
 {
<font color='#880000'>-  the_chain->first          = _Chain_Tail(the_chain);
-  the_chain->permanent_null = NULL;
-  the_chain->last           = _Chain_Head(the_chain);
</font><font color='#000088'>+  Chain_Node *head = _Chain_Head( the_chain );
+  Chain_Node *tail = _Chain_Tail( the_chain );
+
+  head->next = tail;
+  head->previous = NULL;
+  tail->previous = head;
</font> }
 
 /** @brief Extract this Node (unprotected)
<font color='#997700'>@@ -360,15 +427,14 @@
</font>   Chain_Control *the_chain
 )
 {
<font color='#880000'>-  Chain_Node  *return_node;
-  Chain_Node  *new_first;
</font><font color='#000088'>+  Chain_Node *head = _Chain_Head( the_chain );
+  Chain_Node *old_first = head->next;
+  Chain_Node *new_first = old_first->next;
</font> 
<font color='#880000'>-  return_node         = the_chain->first;
-  new_first           = return_node->next;
-  the_chain->first    = new_first;
-  new_first->previous = _Chain_Head(the_chain);
</font><font color='#000088'>+  head->next = new_first;
+  new_first->previous = head;
</font> 
<font color='#880000'>-  return return_node;
</font><font color='#000088'>+  return old_first;
</font> }
 
 /** @brief Get the First Node (unprotected)
<font color='#997700'>@@ -435,13 +501,13 @@
</font>   Chain_Node    *the_node
 )
 {
<font color='#880000'>-  Chain_Node *old_last_node;
</font><font color='#000088'>+  Chain_Node *tail = _Chain_Tail( the_chain );
+  Chain_Node *old_last = tail->previous;
</font> 
<font color='#880000'>-  the_node->next      = _Chain_Tail(the_chain);
-  old_last_node       = the_chain->last;
-  the_chain->last     = the_node;
-  old_last_node->next = the_node;
-  the_node->previous  = old_last_node;
</font><font color='#000088'>+  the_node->next = tail;
+  tail->previous = the_node;
+  old_last->next = the_node;
+  the_node->previous = old_last;
</font> }
 
 /** @brief Prepend a Node (unprotected)
<font color='#997700'>@@ -556,17 +622,19 @@
</font> )
 {
   bool is_empty_now = true;
<font color='#880000'>-  Chain_Node *first = the_chain->first;
</font><font color='#000088'>+  Chain_Node *head = _Chain_Head( the_chain );
+  Chain_Node *tail = _Chain_Tail( the_chain );
+  Chain_Node *old_first = head->next;
</font> 
<font color='#880000'>-  if ( first != _Chain_Tail( the_chain ) ) {
-    Chain_Node *new_first = first->next;
</font><font color='#000088'>+  if ( old_first != tail ) {
+    Chain_Node *new_first = old_first->next;
</font> 
<font color='#880000'>-    the_chain->first = new_first;
-    new_first->previous = _Chain_Head( the_chain );
</font><font color='#000088'>+    head->next = new_first;
+    new_first->previous = head;
</font> 
<font color='#880000'>-    *the_node = first;
</font><font color='#000088'>+    *the_node = old_first;
</font> 
<font color='#880000'>-    is_empty_now = new_first == _Chain_Tail( the_chain );
</font><font color='#000088'>+    is_empty_now = new_first == tail;
</font>   } else
     *the_node = NULL;
 
</pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>