[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

about the doubly linked chain:



(1) in file "chain.inl"

boolean _Chain_Is_first(
  Chain_Node *the_node
)
{
  return ( the_node->previous == NULL );
}

i think it should be:

boolean _Chain_Is_first(
  Chain_Node *the_node,
  Chain_Control *the_chain
)
{
  return ( the_node->previous == _Chain_Head( the_chain ) );
}

accordingly, the function _Chain_Is_last:

boolean _Chain_Is_last(
  Chain_Node *the_node
)
{
  return ( the_node->next == NULL );
}

it should be:

boolean _Chain_Is_last(
  Chain_Node *the_node,
  Chain_Control *the_chain
)
{
  return ( the_node->next == _Chain_Tail( the_chain ) );
}

am i right?

(2) the control structure of chain in rtems:
typedef struct {
  Chain_Node *first;
  Chain_Node *permanent_null;
  Chain_Node *last;
} Chain_Control;

what is the advantages does this structure have over
usual circular doubly linked chain:
typedef struct {
  Chain_Node *first;  // point to the first node
  Chain_Node *last;   // point to the last node 
} Chain_Control;

                                         Bert
========================================================

???? ???? VIP?????? ??????       http://vip.163.com

???????????? 25???4????????? http://mail.163.com

?????????? ??????????!????   http://popo.163.com