Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Git Source Tree
Root/
| 1 | This issue is under review: |
| 2 | https://www.rtems.org/bugzilla/show_bug.cgi?id=1964 |
| 3 | |
| 4 | Doubly-linked lists ("chains") in RTEMS have a "control" block that |
| 5 | looks like the next/prev link pair in an element. The list elements |
| 6 | link both ways to this control block. |
| 7 | |
| 8 | _Chain_Is_first and _Chain_Is_last only probed if the link to the |
| 9 | next element - which would be the control block - is non-NULL. |
| 10 | Telling by the function description and given that there are already |
| 11 | functions called _Chain_Is_head and _Chain_Is_tail (which could be |
| 12 | simplified), this is probably not the intended behaviour. |
| 13 | |
| 14 | This also affects the aliases rtems_chain_is_first and |
| 15 | rtems_chain_is_last. |
| 16 | |
| 17 | These functions are not used a lot and I haven't seen any immediate |
| 18 | effect on M1 after changing them, so I can't say whether this patch |
| 19 | may unearth other problems. |
| 20 | |
| 21 | - Werner |
| 22 | |
| 23 | Index: rtems/cpukit/score/inline/rtems/score/chain.inl |
| 24 | =================================================================== |
| 25 | --- rtems.orig/cpukit/score/inline/rtems/score/chain.inl 2011-11-12 09:12:46.000000000 -0300 |
| 26 | +++ rtems/cpukit/score/inline/rtems/score/chain.inl 2011-11-12 09:13:47.000000000 -0300 |
| 27 | @@ -297,7 +297,7 @@ |
| 28 | const Chain_Node *the_node |
| 29 | ) |
| 30 | { |
| 31 | - return (the_node->previous == NULL); |
| 32 | + return the_node->previous->previous == NULL; |
| 33 | } |
| 34 | |
| 35 | /** @brief Is this the Last Node on the Chain |
| 36 | @@ -314,7 +314,7 @@ |
| 37 | const Chain_Node *the_node |
| 38 | ) |
| 39 | { |
| 40 | - return (the_node->next == NULL); |
| 41 | + return the_node->next->next == NULL; |
| 42 | } |
| 43 | |
| 44 | /** @brief Does this Chain have only One Node |
| 45 |
Branches:
master
