|
ocssw
1.0
|
#include <stdlib.h>Go to the source code of this file.
Classes | |
| struct | EPR_SPtrArray |
Functions | |
| EPR_SPtrArray * | epr_create_ptr_array (unsigned int capacity) |
| void | epr_free_ptr_array (EPR_SPtrArray *ptr_array) |
| void | epr_free_char_ptr_array (EPR_SPtrArray *char_ptr_array) |
| int | epr_add_ptr_array_elem (EPR_SPtrArray *ptr_array, void *elem) |
| int | epr_grow_ptr_array (EPR_SPtrArray *ptr_array, unsigned int capacity) |
| unsigned int | epr_get_ptr_array_length (const EPR_SPtrArray *ptr_array) |
| unsigned int | epr_get_ptr_array_capacity (const EPR_SPtrArray *ptr_array) |
| void * | epr_get_ptr_array_elem_at (const EPR_SPtrArray *ptr_array, unsigned int index) |
| int epr_add_ptr_array_elem | ( | EPR_SPtrArray * | ptr_array, |
| void * | elem | ||
| ) |
Adds a new pointer to the given pointer array. The function automatically grows the array if necessary.
| ptr_array | the pointer array to which to add the new element, must not be NULL. |
| elem | the element to be added |
Definition at line 75 of file epr_ptrarray.c.
| EPR_SPtrArray* epr_create_ptr_array | ( | unsigned int | capacity | ) |
Creates a new dynamic pointer array instance.
| capacity | the initial capacity |
NULL if memory could not be allocated Definition at line 29 of file epr_ptrarray.c.
| void epr_free_char_ptr_array | ( | EPR_SPtrArray * | char_ptr_array | ) |
Special application of the epr_free_ptr_array for arrays that contain dynamically allocated strings (type char*).
For each element in the given array the epr_free_string function is called.
| char_ptr_array | an array containing strings |
Definition at line 65 of file epr_ptrarray.c.
| void epr_free_ptr_array | ( | EPR_SPtrArray * | ptr_array | ) |
Frees the memory allocated through the given dynamic pointer array.
After calling this function the give record pointer array gets invalid and should not be used anymore.
| ptr_array | the pointer array to be released, if NULL the function immediately returns |
Definition at line 51 of file epr_ptrarray.c.
| unsigned int epr_get_ptr_array_capacity | ( | const EPR_SPtrArray * | ptr_array | ) |
Returns the capacity of the given pointer array.
| ptr_array | the pointer array, must not be NULL. |
| void* epr_get_ptr_array_elem_at | ( | const EPR_SPtrArray * | ptr_array, |
| unsigned int | index | ||
| ) |
Gets the element with the specified index of the given pointer array.
| ptr_array | the pointer array, must not be NULL. |
| index | the zero-based index, must be less than the array's length |
Definition at line 122 of file epr_ptrarray.c.
| unsigned int epr_get_ptr_array_length | ( | const EPR_SPtrArray * | ptr_array | ) |
Returns the length of the given pointer array.
| ptr_array | the pointer array, must not be NULL. |
Definition at line 115 of file epr_ptrarray.c.
| int epr_grow_ptr_array | ( | EPR_SPtrArray * | ptr_array, |
| unsigned int | capacity | ||
| ) |
Grows the given pointer array so that is has the given capacity. The length of the array is not touched by this function.
| ptr_array | the pointer array to which to add the new element, must not be NULL. |
| capacity | the new capacity |
Definition at line 91 of file epr_ptrarray.c.
1.7.6.1