From b006aa66a8f538693e54ebca2b82a8e3decf6754 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Fri, 29 Apr 2011 22:18:10 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BE=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20pool=5Ffree()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c/malloc_speed_test/pool_list.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/c/malloc_speed_test/pool_list.c b/c/malloc_speed_test/pool_list.c index bafe9e0..4ff0f8d 100644 --- a/c/malloc_speed_test/pool_list.c +++ b/c/malloc_speed_test/pool_list.c @@ -74,27 +74,22 @@ inline void pool_free(void *p) struct block_s *b1 = (struct block_s *)(p - 2 * sizeof(struct block_s *)), *b0 = b1->prev, - *b2 = b1->next, - *f1 = free_pool; + *b2 = b1->next; - // cut block from free list if (b0) b0->next = b2; if (b2) b2->prev = b0; - // f1, b1 - if (f1) { - b1->next = f1; - f1->prev = b1; + if (free_pool) { + b1->next = free_pool; + free_pool->prev = b1; } else b1->next = NULL; - // free_pool free_pool = b2; - // busy_pool if (busy_pool == b1) busy_pool = b2; }