mirror of
https://github.com/transmission/transmission
synced 2024-12-24 00:34:04 +00:00
(trunk libT) #1743: potential threading issue in tr_list. only affects 1.50b[1-3]
This commit is contained in:
parent
6a1c91b6ca
commit
ce9eff1fb2
1 changed files with 2 additions and 25 deletions
|
@ -14,39 +14,16 @@
|
|||
#include "list.h"
|
||||
#include "utils.h"
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
static tr_list * _unusedNodes = NULL;
|
||||
|
||||
static const tr_list TR_LIST_INIT = { NULL, NULL, NULL };
|
||||
|
||||
static tr_list*
|
||||
node_alloc( void )
|
||||
{
|
||||
tr_list * node;
|
||||
|
||||
if( _unusedNodes == NULL )
|
||||
node = tr_new( tr_list, 1 );
|
||||
else {
|
||||
node = _unusedNodes;
|
||||
_unusedNodes = node->next;
|
||||
}
|
||||
|
||||
*node = TR_LIST_INIT;
|
||||
return node;
|
||||
return tr_new0( tr_list, 1 );
|
||||
}
|
||||
|
||||
static void
|
||||
node_free( tr_list* node )
|
||||
{
|
||||
if( node )
|
||||
{
|
||||
*node = TR_LIST_INIT;
|
||||
node->next = _unusedNodes;
|
||||
_unusedNodes = node;
|
||||
}
|
||||
tr_free( node );
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
Loading…
Reference in a new issue