Quash Shell
0.1
A simple yet powerfull shell program
|
An abstraction of malloc that allows for all allocations in the pool to be free'd with a single call to destroy_memory_pool(). Allocations to the memory pool should NOT be manually free'd with a call to free(). More...
#include <stdlib.h>
Go to the source code of this file.
Functions | |
void | initialize_memory_pool (size_t size) |
Allocate the memory pool. More... | |
void * | memory_pool_alloc (size_t size) |
Reserve some space in the memory pool and returns a unique address that can be written to and read from. This can be thought of exactly like malloc() without the requirement of calling free() directly on the returned pointer. More... | |
void | destroy_memory_pool () |
Free all memory allocated in the memory pool. | |
char * | memory_pool_strdup (const char *str) |
A version of strdup() that allocates the duplicate to the memory pool rather than with malloc directly. More... | |
An abstraction of malloc that allows for all allocations in the pool to be free'd with a single call to destroy_memory_pool(). Allocations to the memory pool should NOT be manually free'd with a call to free().
void initialize_memory_pool | ( | size_t | size | ) |
Allocate the memory pool.
size | The initial size of the memory pool. If this value is zero then a default size of one is used. |
void* memory_pool_alloc | ( | size_t | size | ) |
Reserve some space in the memory pool and returns a unique address that can be written to and read from. This can be thought of exactly like malloc() without the requirement of calling free() directly on the returned pointer.
size | Size in bytes of the requested reserved space |
char* memory_pool_strdup | ( | const char * | str | ) |
A version of strdup() that allocates the duplicate to the memory pool rather than with malloc directly.
str | Pointer to the string to duplicate |