Lines Matching refs:pList

37 void		InitLinkedList( GenLinkedList *pList, size_t linkOffset)  in InitLinkedList()  argument
40 pList->Head = NULL; in InitLinkedList()
41 pList->Tail = NULL; in InitLinkedList()
42 pList->LinkOffset = linkOffset; in InitLinkedList()
46 void AddToTail( GenLinkedList *pList, void *elem) in AddToTail() argument
49 if ( pList->Tail) { in AddToTail()
50 ASSIGNLINK( pList->Tail, elem, pList->LinkOffset); in AddToTail()
52 pList->Head = elem; in AddToTail()
53 ASSIGNLINK( elem, NULL, pList->LinkOffset); in AddToTail()
55 pList->Tail = elem; in AddToTail()
59 void AddToHead( GenLinkedList *pList, void *elem) in AddToHead() argument
62 ASSIGNLINK( elem, pList->Head, pList->LinkOffset); in AddToHead()
63 if ( pList->Tail == NULL) in AddToHead()
64 pList->Tail = elem; in AddToHead()
66 pList->Head = elem; in AddToHead()
70 int RemoveFromList( GenLinkedList *pList, void *elem) in RemoveFromList() argument
76 for ( iElem = pList->Head, lastElem = NULL; iElem; iElem = GETLINK( iElem, pList->LinkOffset)) { in RemoveFromList()
79 ASSIGNLINK( lastElem, GETLINK( elem, pList->LinkOffset), pList->LinkOffset); in RemoveFromList()
81 pList->Head = GETLINK( elem, pList->LinkOffset); in RemoveFromList()
83 if ( pList->Tail == elem) in RemoveFromList()
84 pList->Tail = lastElem ? lastElem : NULL; in RemoveFromList()
85 ASSIGNLINK( elem, NULL, pList->LinkOffset); // maybe catch a stale reference bug. in RemoveFromList()
95 int ReplaceElem( GenLinkedList *pList, void *elemInList, void *newElem) in ReplaceElem() argument
103 for ( iElem = pList->Head, lastElem = NULL; iElem; iElem = GETLINK( iElem, pList->LinkOffset)) in ReplaceElem()
107 ASSIGNLINK( newElem, GETLINK( elemInList, pList->LinkOffset), pList->LinkOffset); in ReplaceElem()
110 ASSIGNLINK( lastElem, newElem, pList->LinkOffset); in ReplaceElem()
114 pList->Head = newElem; in ReplaceElem()
116 if ( pList->Tail == elemInList) in ReplaceElem()
117 pList->Tail = newElem; in ReplaceElem()
129 void InitDoubleLinkedList( GenDoubleLinkedList *pList, size_t fwdLinkOffset, in InitDoubleLinkedList() argument
133 pList->Head = NULL; in InitDoubleLinkedList()
134 pList->Tail = NULL; in InitDoubleLinkedList()
135 pList->FwdLinkOffset = fwdLinkOffset; in InitDoubleLinkedList()
136 pList->BackLinkOffset = backLinkOffset; in InitDoubleLinkedList()
140 void DLLAddToHead( GenDoubleLinkedList *pList, void *elem) in DLLAddToHead() argument
145 pNext = pList->Head; in DLLAddToHead()
148 ASSIGNLINK( elem, pList->Head, pList->FwdLinkOffset); in DLLAddToHead()
149 pList->Head = elem; in DLLAddToHead()
153 ASSIGNLINK( pNext, elem, pList->BackLinkOffset); in DLLAddToHead()
155 pList->Tail = elem; in DLLAddToHead()
156 ASSIGNLINK( elem, NULL, pList->BackLinkOffset); in DLLAddToHead()
160 void DLLRemoveFromList( GenDoubleLinkedList *pList, void *elem) in DLLRemoveFromList() argument
166 pNext = GETLINK( elem, pList->FwdLinkOffset); in DLLRemoveFromList()
167 pPrev = GETLINK( elem, pList->BackLinkOffset); in DLLRemoveFromList()
171 ASSIGNLINK( pPrev, pNext, pList->FwdLinkOffset); in DLLRemoveFromList()
173 pList->Head = pNext; in DLLRemoveFromList()
177 ASSIGNLINK( pNext, pPrev, pList->BackLinkOffset); in DLLRemoveFromList()
179 pList->Tail = pPrev; in DLLRemoveFromList()
181 ASSIGNLINK( elem, NULL, pList->FwdLinkOffset); in DLLRemoveFromList()
182 ASSIGNLINK( elem, NULL, pList->BackLinkOffset); in DLLRemoveFromList()
201 void *GetHeadPtr( GenLinkedOffsetList *pList) in GetHeadPtr() argument
204 return pList->Head ? ( (char*) (pList) + pList->Head) : NULL; in GetHeadPtr()
208 void *GetTailPtr( GenLinkedOffsetList *pList) in GetTailPtr() argument
211 return pList->Tail ? ( (char*) (pList) + pList->Tail) : NULL; in GetTailPtr()
215 void *GetOffsetLink( GenLinkedOffsetList *pList, void *elem) in GetOffsetLink() argument
220 nextOffset = GETOFFSET( elem, pList->LinkOffset); in GetOffsetLink()
226 void InitLinkedOffsetList( GenLinkedOffsetList *pList, size_t linkOffset) in InitLinkedOffsetList() argument
229 pList->Head = 0; in InitLinkedOffsetList()
230 pList->Tail = 0; in InitLinkedOffsetList()
231 pList->LinkOffset = linkOffset; in InitLinkedOffsetList()
235 void OffsetAddToTail( GenLinkedOffsetList *pList, void *elem) in OffsetAddToTail() argument
238 if ( pList->Tail) { in OffsetAddToTail()
239 AssignOffsetLink( GetTailPtr( pList), elem, pList->LinkOffset); in OffsetAddToTail()
241 pList->Head = (size_t) elem - (size_t) pList; in OffsetAddToTail()
242 AssignOffsetLink( elem, NULL, pList->LinkOffset); in OffsetAddToTail()
244 pList->Tail = (size_t) elem - (size_t) pList; in OffsetAddToTail()
248 void OffsetAddToHead( GenLinkedOffsetList *pList, void *elem) in OffsetAddToHead() argument
251 AssignOffsetLink( elem, GetHeadPtr( pList), pList->LinkOffset); in OffsetAddToHead()
252 if ( pList->Tail == 0) in OffsetAddToHead()
253 pList->Tail = (size_t) elem - (size_t) pList; in OffsetAddToHead()
255 pList->Head = (size_t) elem - (size_t) pList; in OffsetAddToHead()
259 int OffsetRemoveFromList( GenLinkedOffsetList *pList, void *elem) in OffsetRemoveFromList() argument
265 for ( iElem = GetHeadPtr( pList), lastElem = NULL; iElem; in OffsetRemoveFromList()
266 iElem = GetOffsetLink( pList, iElem)) in OffsetRemoveFromList()
270 AssignOffsetLink( lastElem, GetOffsetLink( pList, elem), pList->LinkOffset); in OffsetRemoveFromList()
272 iElem = GetOffsetLink( pList, elem); in OffsetRemoveFromList()
273 pList->Head = iElem ? (size_t) iElem - (size_t) pList : 0; in OffsetRemoveFromList()
275 if ( GetTailPtr( pList) == elem) in OffsetRemoveFromList()
276 pList->Tail = lastElem ? (size_t) lastElem - (size_t) pList : 0; in OffsetRemoveFromList()
277 AssignOffsetLink( elem, NULL, pList->LinkOffset); // maybe catch a stale reference bug. in OffsetRemoveFromList()
287 int OffsetReplaceElem( GenLinkedOffsetList *pList, void *elemInList, void *newElem) in OffsetReplaceElem() argument
295 for ( iElem = GetHeadPtr( pList), lastElem = NULL; iElem; in OffsetReplaceElem()
296 iElem = GetOffsetLink( pList, iElem)) in OffsetReplaceElem()
300 AssignOffsetLink( newElem, GetOffsetLink( pList, elemInList), pList->LinkOffset); in OffsetReplaceElem()
303 AssignOffsetLink( lastElem, newElem, pList->LinkOffset); in OffsetReplaceElem()
307 pList->Head = (size_t) newElem - (size_t) pList; in OffsetReplaceElem()
309 if ( GetTailPtr( pList) == elemInList) in OffsetReplaceElem()
310 pList->Tail = (size_t) newElem - (size_t) pList; in OffsetReplaceElem()