#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | array_type |
Defines | |
#define | arysize(x) ((*((array_type**)(void*)(x))-1)->size) |
#define | arymax(x) ((*((array_type**)(void*)(x))-1)->max) |
#define | aryalloc(x) aryalloc_(sizeof(x)) |
#define | aryallocsize(x, y) aryallocsize_(sizeof(x),y) |
#define | aryclear(x) (((*((array_type**)(void*)(x))-1)->size)=0) |
Typedefs | |
typedef array_type | array_type |
Functions | |
void * | aryalloc_ (size_t esize) |
void * | aryallocsize_ (size_t esize, size_t size) |
void | aryfree (void *array) |
int | aryreserve (void *array, size_t max) |
int | aryresize (void *array, size_t size) |
int | aryappend (void *array, const void *element) |
int | aryinsert (void *array, size_t index) |
int | aryerase (void *array, size_t index) |
int | aryfasterase (void *array, size_t index) |
void * | arydup (const void *array) |
int | arycpy (void *dest, const void *src) |
int | arycat (void *dest, const void *src) |
|
|
|
|
|
|
|
|
|
|
|
|
|
Allocate a new empty array. Normally this function is not called directly. Use the aryalloc() macro instead. This allows you to specify the element type rather than the element size. Example: "int* array = aryalloc(int);"
|
|
Allocate a new array of a specified size. Normally this function is not called directly. Use the aryallocsize() macro instead. Example: "int* array = aryallocsize(int, 2000);"
|
|
This adds and copies a new element to the end of the array.
|
|
Appends the source array to the end of the destination
|
|
This copies an array. This is just a convenient way to do an aryfree() followed by arydup().
|
|
This duplicates an array. The new array will use the minimum amount of memory necessary to hold all the elements in the array.
|
|
|
|
|
|
This releases all memory held by an array.
|
|
Inserts a new element at position "index"
|
|
This preallocates memory for a certain maximum number of elements. Note that this does not change the size of the array unless max is less than the current size of the array.
|
|
This resizes an array. Note that this does not free any memory held by the array if the size is smaller than the current size.
|