007-FreeRTOS202212-将节点从链表移出(删除)

/*‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*/
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
{
/*The list item knows which list it is in. Obtain the list from the list*/
/*链表项知道它在哪个链表中。获取节点所在链表*/
List_t * const pxList = ( List_t * ) pxItemToRemove‐>pvContainer;
/* 调整链表的节点索引指针 */
pxItemToRemove‐>pxNext‐>pxPrevious = pxItemToRemove‐>pxPrevious;
pxItemToRemove‐>pxPrevious‐>pxNext = pxItemToRemove‐>pxNext;
/* Only used during decision coverage testing. */
/*仅在决策覆盖率测试期间使用*/
mtCOVERAGE_TEST_DELAY();
/* Make sure the index is left pointing to a valid item. */
/*确保索引指向有效项*/
if( pxList‐>pxIndex == pxItemToRemove )
{
pxList‐>pxIndex = pxItemToRemove‐>pxPrevious;
}
else
{
mtCOVERAGE_TEST_MARKER();
}
/* 初始化该节点所在的链表为空,表示节点还没有插入任何链表 */
pxItemToRemove‐>pvContainer = NULL;
/* 链表节点计数器‐‐ */
( pxList‐>uxNumberOfItems )‐‐;
/* 返回链表中剩余节点的个数 */
return pxList‐>uxNumberOfItems;
}
/*‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐*/

将节点从链表中移出(删除) 详细过程如下图 ,参考<[野火®]《FreeRTOS 内核实现与应用开发实战—基于STM32》>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值