我爱Aspx >> Asp.Net >> 一个统一的链表结构这是在Linux下面最常用的一个统一的链表结构,Linux就是用这个结构将所有的Driver、Device什么的都分别串在一起。我觉得写得非常好,大家来看一看。
-----------------------------------------------------------------------------------------------------
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H
#ifdef __KERNEL__
struct list_head {
struct list_head *next, *prev;
};
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
/*
* Insert a new entry between two known consecutive entries.
* This is only for internal list manipulation where we know the prev/next entries already!
*/
static __inline__ void __list_add(struct list_head * new, struct list_head * prev, struct list_head * next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
/*
* list_add - add a new entry
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
static __inline__ void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
/*
* list_add_tail - add a new entry
* Insert a new entry before the specified head.
* This is useful for implementing queues.
Ҷƪл˵?
优化delphi5.0秘籍大曝光[05-05]
在C#里如何调用标准DLL函数[05-05]
开放源代码的定义[05-05]
MMX Instructions[05-05]
Opcodes of intel[05-05]
程序员与MM[05-05]
用CTI实现与Web交谈[05-05]
CTI技术和呼叫中心[05-05]
CTI的典型应用之三[05-05]
CTI的典型应用之二[05-05]