Provides functions and structures for maintaining dynamically allocated and freed pools of integers. More...
Go to the source code of this file.
Data Structures | |
struct | guac_pool |
A pool of integers. More... | |
struct | guac_pool_int |
Represents a single integer within a larger pool of integers. More... | |
Functions | |
guac_pool * | guac_pool_alloc (int size) |
Allocates a new guac_pool having the given minimum size. More... | |
void | guac_pool_free (guac_pool *pool) |
Frees the given guac_pool. More... | |
int | guac_pool_next_int (guac_pool *pool) |
Returns the next available integer from the given guac_pool. More... | |
void | guac_pool_free_int (guac_pool *pool, int value) |
Frees the given integer back into the given guac_pool. More... | |
Provides functions and structures for maintaining dynamically allocated and freed pools of integers.
guac_pool* guac_pool_alloc | ( | int | size | ) |
void guac_pool_free | ( | guac_pool * | pool | ) |
void guac_pool_free_int | ( | guac_pool * | pool, |
int | value | ||
) |
Frees the given integer back into the given guac_pool.
The integer given will be available for future calls to guac_pool_next_int.
pool | The guac_pool to free the given integer into. |
value | The integer which should be returned to the given pool, such that it can be received by a future call to guac_pool_next_int. |
int guac_pool_next_int | ( | guac_pool * | pool | ) |
Returns the next available integer from the given guac_pool.
All integers returned are non-negative, and are returned in sequences, starting from 0.
pool | The guac_pool to retrieve an integer from. |