list_add_tail()

来源:互联网 发布:python list 拆分 编辑:程序博客网 时间:2024/06/13 23:26
将new所代表的list_head插入head所索引的队列的尾部
static inline void list_add_tail(struct list_head *newstruct list_head *head)
{
    __list_add(
new, head->prev, head);
}


将new所代表的list_head插入到next索引的双链表(next索引双链表的第一个节点)的尾部

static inline void __list_add(struct list_head *new,
                  
struct list_head *prev,
                  
struct list_head *next)
{
    next
->prev = new//(1)
    new->next = next; //(2)
    new->prev = prev; //(3)
    prev->next = new//(4)
}



            next
new         head----+----------------------------------------------+
|                   |                                              | 
|    list_head      |     list_head     list_head     list_head    | 
|   |---------|     |    |---------|   |---------|   |---------|   | 
+-->|  *next  |     +--->|  *next  |-->|  *next  |-->|  *next  |---+
    |---------|          |---------|   |---------|   |---------|
    |  *prev  |       +--|  *prev  |<--|  *prev  |<--|  *prev  |<--+---prev
    |---------|       |  |---------|   |---------|   |---------|   | 
                      |                                            | 
                      +--------------------------------------------+



   +---------------------+
   |        next         | (4)
new|        head----+    +-----------------------------------------+
|  |                |                                              |
+--+ list_head      |     list_head     list_head     list_head    |
|   |---------|(2)  |    |---------|   |---------|   |---------|   |
+-->|  *next  |-----+--->|  *next  |-->|  *next  |-->|  *next  |---+
    |---------|          |---------|   |---------|   |---------|
+---|  *prev  |<---------|  *prev  |<--|  *prev  |<--|  *prev  |<--+---prev
|   |---------|   (1)    |---------|   |---------|   |---------|   |
|                                                                  |
+------------------------------------------------------------------+
                           (3)
0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 WS_CLIPCHILDREN设置键在哪里 数据结构(严蔚敏李冬梅)课后答案 ipz809 一个字包含的二进制位数 linux面试 【题目2】设计一个结构体类型,包含姓名、出生日期。其中出生日期又包含年、月、日三部分信息。输入n个好 【题目2】设计一个结构体类型,包含姓名、出生日期。其中出生日期又包含年、月、日三部分信息。输入n个好 结构体比较好友中年纪最小的 matlab三维矩阵可视化 使QQ崩溃 scanIP 按照规定,在高速公路上行使的机动车,达到或超出本车道限速的10%则处200元罚款;若达到或超出50% c语言输入三个数字 c语言如何输入三个数求平均值 c语言如何输入三个数求和 C语言为什么只录入了第一个数字 输入多个数字 c语言scanf只有第一个数字 scanf三个整数 double double类型 www和http 会计 日记账 myamnatfound IntroductiontoIoT IntroductiontoIoT 使用哪种类型的无线网络连接城市中的设备来创建城域网 傲世九重天绿帽版 节日 第一章《Java》的思维导图 《Java》的思维导图 python登录大华摄像机 2019普通高等学校招生全国统一考试诊断卷a 考前诊断卷 Travelingsalesmenofnhn.(theprestigiousKoreanintern www。qwer123。com Ubuntu --------------------------http://s.jiafeiyun.com/p getpid函数执行过程 增量模型