about the doubly linked chain

doclzs doclzs at 163.com
Wed May 12 09:53:27 UTC 2004


(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;
========================================================

真情回馈 超值优惠 VIP邮箱买一送四 买三送十二!       http://vip.163.com

中国最大的免费邮箱在等你 25兆空间4兆附件!      http://mail.163.com

点击网易泡泡惊喜无限 全免费手机短信任你发!       http://popo.163.com


More information about the users mailing list