赞
踩
仅仅为struct list_head相关的两个宏:
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
static inline void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}
可以如下:
LIST_HEAD(head);
或者:
struct list_head head;
LIST_HEAD_INIT(head);
#define LIST_HEAD_INIT(name) { &(name), &(name) }
用head的地址初始化其两个成员next和prev ,使其都指向自己
struct list_head {
struct list_head *next, *prev;
};
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。