这样写有什么好处吗?第二个函数只是调用了第一个函数,没有增加什么代码,为什么不直接写一个函数就行
问题相关代码,请勿粘贴截图
static inline void __list_add(struct list_head *new, // 要插入的节点
struct list_head *prev,// 前节点 before struct list_head *next) // 后节点 after{
next->prev = new; // 后节点的上家为new
new->next = next;
new->prev = prev;
prev->next = new;
}
static inline void list_add(struct list_head *new, struct list_head *head){
__list_add(new, head, head->next);
}