2
*************************************************************************
4
* 5F., No.36, Taiyuan St., Jhubei City,
8
* (c) Copyright 2002-2007, Ralink Technology, Inc.
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
15
* This program is distributed in the hope that it will be useful, *
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18
* GNU General Public License for more details. *
20
* You should have received a copy of the GNU General Public License *
21
* along with this program; if not, write to the *
22
* Free Software Foundation, Inc., *
23
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25
*************************************************************************
28
#ifndef __LINK_LIST_H__
29
#define __LINK_LIST_H__
31
typedef struct _LIST_ENTRY
33
struct _LIST_ENTRY *pNext;
34
} LIST_ENTRY, *PLIST_ENTRY;
36
typedef struct _LIST_HEADR
41
} LIST_HEADER, *PLIST_HEADER;
43
static inline VOID initList(
44
IN PLIST_HEADER pList)
46
pList->pHead = pList->pTail = NULL;
51
static inline VOID insertTailList(
52
IN PLIST_HEADER pList,
53
IN PLIST_ENTRY pEntry)
57
pList->pTail->pNext = pEntry;
59
pList->pHead = pEntry;
60
pList->pTail = pEntry;
66
static inline PLIST_ENTRY removeHeadList(
67
IN PLIST_HEADER pList)
72
pEntry = pList->pHead;
73
if (pList->pHead != NULL)
75
pNext = pList->pHead->pNext;
84
static inline int getListSize(
85
IN PLIST_HEADER pList)
90
static inline PLIST_ENTRY delEntryList(
91
IN PLIST_HEADER pList,
92
IN PLIST_ENTRY pEntry)
94
PLIST_ENTRY pCurEntry;
95
PLIST_ENTRY pPrvEntry;
97
if(pList->pHead == NULL)
100
if(pEntry == pList->pHead)
102
pCurEntry = pList->pHead;
103
pList->pHead = pCurEntry->pNext;
105
if(pList->pHead == NULL)
112
pPrvEntry = pList->pHead;
113
pCurEntry = pPrvEntry->pNext;
114
while(pCurEntry != NULL)
116
if (pEntry == pCurEntry)
118
pPrvEntry->pNext = pCurEntry->pNext;
120
if(pEntry == pList->pTail)
121
pList->pTail = pPrvEntry;
126
pPrvEntry = pCurEntry;
127
pCurEntry = pPrvEntry->pNext;
133
#endif // ___LINK_LIST_H__ //
1
#include "../rt2860/link_list.h"