Changeset 7788
- Timestamp:
- Jan 24, 2009, 2:33:25 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/list.c
r7658 r7788 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 25 17 static tr_list* 26 18 node_alloc( void ) 27 19 { 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; 20 return tr_new0( tr_list, 1 ); 39 21 } 40 22 … … 42 24 node_free( tr_list* node ) 43 25 { 44 if( node ) 45 { 46 *node = TR_LIST_INIT; 47 node->next = _unusedNodes; 48 _unusedNodes = node; 49 } 26 tr_free( node ); 50 27 } 51 28
Note: See TracChangeset
for help on using the changeset viewer.