Lines Matching refs:elem
46 void AddToTail( GenLinkedList *pList, void *elem)
50 ASSIGNLINK( pList->Tail, elem, pList->LinkOffset);
52 pList->Head = elem;
53 ASSIGNLINK( elem, NULL, pList->LinkOffset);
55 pList->Tail = elem;
59 void AddToHead( GenLinkedList *pList, void *elem)
62 ASSIGNLINK( elem, pList->Head, pList->LinkOffset);
64 pList->Tail = elem;
66 pList->Head = elem;
70 int RemoveFromList( GenLinkedList *pList, void *elem)
77 if ( iElem == elem) {
79 ASSIGNLINK( lastElem, GETLINK( elem, pList->LinkOffset), pList->LinkOffset);
81 pList->Head = GETLINK( elem, pList->LinkOffset);
83 if ( pList->Tail == elem)
85 ASSIGNLINK( elem, NULL, pList->LinkOffset); // maybe catch a stale reference bug.
140 void DLLAddToHead( GenDoubleLinkedList *pList, void *elem)
148 ASSIGNLINK( elem, pList->Head, pList->FwdLinkOffset);
149 pList->Head = elem;
153 ASSIGNLINK( pNext, elem, pList->BackLinkOffset);
155 pList->Tail = elem;
156 ASSIGNLINK( elem, NULL, pList->BackLinkOffset);
160 void DLLRemoveFromList( GenDoubleLinkedList *pList, void *elem)
166 pNext = GETLINK( elem, pList->FwdLinkOffset);
167 pPrev = GETLINK( elem, pList->BackLinkOffset);
181 ASSIGNLINK( elem, NULL, pList->FwdLinkOffset);
182 ASSIGNLINK( elem, NULL, pList->BackLinkOffset);
191 static void AssignOffsetLink( void *elem, void *link, size_t linkOffset);
194 static void AssignOffsetLink( void *elem, void *link, size_t linkOffset)
195 // Assign link to elem as an offset from elem. Assign 0 to elem if link is NULL.
197 GETOFFSET( elem, linkOffset) = link ? (size_t) link - (size_t) elem : 0;
215 void *GetOffsetLink( GenLinkedOffsetList *pList, void *elem)
220 nextOffset = GETOFFSET( elem, pList->LinkOffset);
222 return nextOffset ? (char*) elem + nextOffset : NULL;
235 void OffsetAddToTail( GenLinkedOffsetList *pList, void *elem)
239 AssignOffsetLink( GetTailPtr( pList), elem, pList->LinkOffset);
241 pList->Head = (size_t) elem - (size_t) pList;
242 AssignOffsetLink( elem, NULL, pList->LinkOffset);
244 pList->Tail = (size_t) elem - (size_t) pList;
248 void OffsetAddToHead( GenLinkedOffsetList *pList, void *elem)
251 AssignOffsetLink( elem, GetHeadPtr( pList), pList->LinkOffset);
253 pList->Tail = (size_t) elem - (size_t) pList;
255 pList->Head = (size_t) elem - (size_t) pList;
259 int OffsetRemoveFromList( GenLinkedOffsetList *pList, void *elem)
268 if ( iElem == elem) {
270 AssignOffsetLink( lastElem, GetOffsetLink( pList, elem), pList->LinkOffset);
272 iElem = GetOffsetLink( pList, elem);
275 if ( GetTailPtr( pList) == elem)
277 AssignOffsetLink( elem, NULL, pList->LinkOffset); // maybe catch a stale reference bug.