【发布时间】:2013-05-07 13:14:51
【问题描述】:
list_empty()函数在./include/linux/list.h中定义,其定义为
static inline int list_empty(const struct list_head *head)
{
return head->next == head;
}
list_head数据结构定义为
struct list_head {
struct list_head *next, *prev;
};
我不明白为什么内核中的这个实现会检查 head->next == head 而不是 head->next == NULL && head->prev == NULL。
【问题讨论】:
标签: c linux-kernel linked-list kernel