Root/m1/patches/rtems/chain-first-last.patch

Source at commit f6fd776f528905e346c7f1caec97945535c7ca43 created 8 years 4 months ago.
By Werner Almesberger, m1/patches/rtems/: Milkymist-specific patches are in upstream (update by Xiangfu)
1This issue is under review:
2https://www.rtems.org/bugzilla/show_bug.cgi?id=1964
3
4Doubly-linked lists ("chains") in RTEMS have a "control" block that
5looks like the next/prev link pair in an element. The list elements
6link both ways to this control block.
7
8_Chain_Is_first and _Chain_Is_last only probed if the link to the
9next element - which would be the control block - is non-NULL.
10Telling by the function description and given that there are already
11functions called _Chain_Is_head and _Chain_Is_tail (which could be
12simplified), this is probably not the intended behaviour.
13
14This also affects the aliases rtems_chain_is_first and
15rtems_chain_is_last.
16
17These functions are not used a lot and I haven't seen any immediate
18effect on M1 after changing them, so I can't say whether this patch
19may unearth other problems.
20
21- Werner
22
23Index: 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

Archive Download this file

Branches:
master



interactive