комменты к функциям

This commit is contained in:
Kolan Sh 2011-04-30 16:15:40 +04:00
parent 065f348402
commit f86b064fff
1 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,6 @@
#include <stdio.h> #include <stdio.h>
#define bool char
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
@ -50,6 +49,9 @@ void pool_init(struct block_pool *bp, size_t nblocks)
bp->busy_pool = NULL; bp->busy_pool = NULL;
} }
/*
* уничтожение пула
*/
void pool_destroy(struct block_pool *bp) void pool_destroy(struct block_pool *bp)
{ {
free(bp->pool); free(bp->pool);
@ -57,6 +59,9 @@ void pool_destroy(struct block_pool *bp)
bp->pool = bp->free_pool = bp->busy_pool = NULL; bp->pool = bp->free_pool = bp->busy_pool = NULL;
} }
/*
* выдача блока из пула
*/
void *pool_alloc(struct block_pool *bp) void *pool_alloc(struct block_pool *bp)
{ {
if (!bp->free_pool) if (!bp->free_pool)
@ -78,6 +83,9 @@ void *pool_alloc(struct block_pool *bp)
return &bp->busy_pool->obj; return &bp->busy_pool->obj;
} }
/*
* возвращение блока в пул
*/
void pool_free(struct block_pool *bp, void *p) void pool_free(struct block_pool *bp, void *p)
{ {
if (!p) if (!p)