Changeset 10583 for branches/1.9x/libtransmission/list.c
- Timestamp:
- May 1, 2010, 4:37:52 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.9x/libtransmission/list.c
r9891 r10583 158 158 return size; 159 159 } 160 161 162 163 /*164 * Double-linked list with easy memory management and fast165 * insert/remove operations166 */167 168 169 void170 __tr_list_insert( struct __tr_list * list,171 struct __tr_list * prev,172 struct __tr_list * next)173 {174 next->prev = list;175 list->next = next;176 list->prev = prev;177 prev->next = list;178 }179 180 static void181 __tr_list_splice( struct __tr_list * prev,182 struct __tr_list * next)183 {184 next->prev = prev;185 prev->next = next;186 }187 188 void189 __tr_list_remove( struct __tr_list * head )190 {191 __tr_list_splice( head->prev, head->next );192 head->next = head->prev = NULL;193 }194 195 void196 __tr_list_destroy( struct __tr_list * head,197 __tr_list_free_t func)198 {199 while ( head->next != head )200 {201 struct __tr_list * list = head->next;202 __tr_list_splice( list->prev, list->next );203 204 func( list );205 }206 }
Note: See TracChangeset
for help on using the changeset viewer.