Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 534308
Collapse All | Expand All

(-)/trunk/libtransmission/list.c (-12 / +18 lines)
Lines 31-46 Link Here
31
node_alloc (void)
31
node_alloc (void)
32
{
32
{
33
  tr_list * ret;
33
  tr_list * ret = NULL;
34
34
  tr_lock * lock = getRecycledNodesLock ();
35
  if (recycled_nodes == NULL)
35
36
    {
36
  tr_lockLock (lock);
37
      ret = tr_new (tr_list, 1);
37
38
    }
38
  if (recycled_nodes != NULL)
39
  else
39
    {
40
    {
41
      tr_lockLock (getRecycledNodesLock ());
42
      ret = recycled_nodes;
40
      ret = recycled_nodes;
43
      recycled_nodes = recycled_nodes->next;
41
      recycled_nodes = recycled_nodes->next;
44
      tr_lockUnlock (getRecycledNodesLock ());
42
    }
43
44
  tr_lockUnlock (lock);
45
46
  if (ret == NULL)
47
    {
48
      ret = tr_new (tr_list, 1);
45
    }
49
    }
46
50
Lines 52-62 Link Here
52
node_free (tr_list* node)
56
node_free (tr_list* node)
53
{
57
{
58
  tr_lock * lock = getRecycledNodesLock ();
59
54
  if (node != NULL)
60
  if (node != NULL)
55
    {
61
    {
56
      *node = TR_LIST_CLEAR;
62
      *node = TR_LIST_CLEAR;
57
      tr_lockLock (getRecycledNodesLock ());
63
      tr_lockLock (lock);
58
      node->next = recycled_nodes;
64
      node->next = recycled_nodes;
59
      recycled_nodes = node;
65
      recycled_nodes = node;
60
      tr_lockUnlock (getRecycledNodesLock ());
66
      tr_lockUnlock (lock);
61
    }
67
    }
62
}
68
}

Return to bug 534308