mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +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 "list.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
/***
|
|
||||||
****
|
|
||||||
***/
|
|
||||||
|
|
||||||
static tr_list * _unusedNodes = NULL;
|
|
||||||
|
|
||||||
static const tr_list TR_LIST_INIT = { NULL, NULL, NULL };
|
|
||||||
|
|
||||||
static tr_list*
|
static tr_list*
|
||||||
node_alloc( void )
|
node_alloc( void )
|
||||||
{
|
{
|
||||||
tr_list * node;
|
return tr_new0( tr_list, 1 );
|
||||||
|
|
||||||
if( _unusedNodes == NULL )
|
|
||||||
node = tr_new( tr_list, 1 );
|
|
||||||
else {
|
|
||||||
node = _unusedNodes;
|
|
||||||
_unusedNodes = node->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
*node = TR_LIST_INIT;
|
|
||||||
return node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
node_free( tr_list* node )
|
node_free( tr_list* node )
|
||||||
{
|
{
|
||||||
if( node )
|
tr_free( node );
|
||||||
{
|
|
||||||
*node = TR_LIST_INIT;
|
|
||||||
node->next = _unusedNodes;
|
|
||||||
_unusedNodes = node;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
|
|
Loading…
Reference in a new issue