[RTEMS Project] #1504: Infinite loop on example
RTEMS trac
trac at rtems.org
Sun Nov 23 19:07:58 UTC 2014
#1504: Infinite loop on example
-----------------------------+---------------------
Reporter: alin.codejunkie | Owner: chrisj
Type: defect | Status: closed
Priority: normal | Milestone: 4.10
Component: doc | Version: 4.10
Severity: normal | Resolution: fixed
Keywords: |
-----------------------------+---------------------
Changes (by joel.sherrill):
* version: unknown => 4.10
Old description:
> The example in the following url is flawed
> http://www.rtems.org/onlinedocs//doc-
> current/share/rtems/html/c_user/c_user00514.html
>
> The if checks if the strings are the same, if so if goes to the next
> node, otherwise it doesn't which is not a correct behavior.
>
> This is an alternative way of correcting the code
>
> while (!rtems_chain_is_tail (chain, node))
> {
> bar = (foo*) node;
> rtems_chain_node* next_node = node->next;
>
> if (strcmp (match, bar->data) == 0)
> {
> rtems_chain_extract (node);
> rtems_chain_append (out, node);
> }
>
> node = next_node;
> }
New description:
The example in the following url is flawed http://www.rtems.org/onlinedocs
//doc-current/share/rtems/html/c_user/c_user00514.html
The if checks if the strings are the same, if so if goes to the next node,
otherwise it doesn't which is not a correct behavior.
This is an alternative way of correcting the code
while (!rtems_chain_is_tail (chain, node))
{
bar = (foo*) node;
rtems_chain_node* next_node = node->next;
if (strcmp (match, bar->data) == 0)
{
rtems_chain_extract (node);
rtems_chain_append (out, node);
}
node = next_node;
}
--
--
Ticket URL: <http://devel.rtems.org/ticket/1504#comment:3>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list