Changeset 7527
- Timestamp:
- Dec 29, 2008, 5:28:14 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/list.c
r7469 r7527 15 15 #include "utils.h" 16 16 17 /*** 18 **** 19 ***/ 20 21 static tr_list * _unusedNodes = NULL; 22 23 static const tr_list TR_LIST_INIT = { NULL, NULL, NULL }; 24 17 25 static tr_list* 18 26 node_alloc( void ) 19 27 { 20 return tr_new0( tr_list, 1 ); 28 tr_list * node; 29 30 if( _unusedNodes == NULL ) 31 node = tr_new( tr_list, 1 ); 32 else { 33 node = _unusedNodes; 34 _unusedNodes = node->next; 35 } 36 37 *node = TR_LIST_INIT; 38 return node; 21 39 } 22 40 … … 24 42 node_free( tr_list* node ) 25 43 { 26 tr_free( node ); 44 if( node ) 45 { 46 *node = TR_LIST_INIT; 47 node->next = _unusedNodes; 48 _unusedNodes = node; 49 } 27 50 } 28 51
Note: See TracChangeset
for help on using the changeset viewer.