оптимизации pool_free()
This commit is contained in:
parent
d8e8aa5962
commit
b006aa66a8
|
@ -74,27 +74,22 @@ inline void pool_free(void *p)
|
||||||
|
|
||||||
struct block_s *b1 = (struct block_s *)(p - 2 * sizeof(struct block_s *)),
|
struct block_s *b1 = (struct block_s *)(p - 2 * sizeof(struct block_s *)),
|
||||||
*b0 = b1->prev,
|
*b0 = b1->prev,
|
||||||
*b2 = b1->next,
|
*b2 = b1->next;
|
||||||
*f1 = free_pool;
|
|
||||||
|
|
||||||
// cut block from free list
|
|
||||||
if (b0)
|
if (b0)
|
||||||
b0->next = b2;
|
b0->next = b2;
|
||||||
if (b2)
|
if (b2)
|
||||||
b2->prev = b0;
|
b2->prev = b0;
|
||||||
|
|
||||||
// f1, b1
|
if (free_pool) {
|
||||||
if (f1) {
|
b1->next = free_pool;
|
||||||
b1->next = f1;
|
free_pool->prev = b1;
|
||||||
f1->prev = b1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
b1->next = NULL;
|
b1->next = NULL;
|
||||||
|
|
||||||
// free_pool
|
|
||||||
free_pool = b2;
|
free_pool = b2;
|
||||||
|
|
||||||
// busy_pool
|
|
||||||
if (busy_pool == b1)
|
if (busy_pool == b1)
|
||||||
busy_pool = b2;
|
busy_pool = b2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue