libcstl
|
Go to the source code of this file.
Data Structures | |
struct | cstl_array_t |
The array object. More... | |
Macros | |
#define | CSTL_ARRAY_INITIALIZER(NAME) |
Initialize an array object at the time of declaration. | |
#define | DECLARE_CSTL_ARRAY(NAME) |
Declare (and initialize) an array object at compile time. | |
Functions | |
static void | cstl_array_init (cstl_array_t *const a) |
Initialize a previously declared/allocated array object. | |
static size_t | cstl_array_size (const cstl_array_t *const a) |
Get the number of elements in the array. | |
void | cstl_array_alloc (cstl_array_t *a, size_t nm, size_t sz) |
Allocate an array to be managed. | |
static void | cstl_array_reset (cstl_array_t *const a) |
Drop a reference to memory managed by this object. | |
const void * | cstl_array_data_const (const cstl_array_t *a) |
Return a pointer to the underlying array. | |
static void * | cstl_array_data (cstl_array_t *const a) |
Return a pointer to the underlying array. | |
const void * | cstl_array_at_const (const cstl_array_t *a, size_t i) |
Return a pointer to an element in the array. | |
static void * | cstl_array_at (cstl_array_t *const a, const size_t i) |
Return a pointer to an element in the array. | |
void | cstl_array_slice (cstl_array_t *a, size_t beg, size_t end, cstl_array_t *s) |
Create an array object referring to a slice of another. | |
void | cstl_array_unslice (cstl_array_t *s, cstl_array_t *a) |
Create an array object referring to the entire underlying array. | |
Danger Zone | |
Functions requiring extra careful handling Callers can use cstl_array_set() to use an externally allocated array, but the caller must cstl_array_release() that array. Otherwise, the code will try to return the array to the heap when the last reference to it goes away. | |
void | cstl_array_set (cstl_array_t *const a, void *buf, size_t nm, size_t sz) |
Manage an externally allocated array. | |
void | cstl_array_release (cstl_array_t *const a, void **buf) |
Release an externally allocated array. | |
Raw Array Functions | |
void | cstl_raw_array_reverse (void *arr, size_t count, size_t size, cstl_swap_func_t *swap, void *tmp) |
Reverse the contents of an array. | |
ssize_t | cstl_raw_array_search (const void *arr, size_t count, size_t size, const void *ex, cstl_compare_func_t *cmp, void *priv) |
Perform a binary search of the array. | |
ssize_t | cstl_raw_array_find (const void *arr, size_t count, size_t size, const void *ex, cstl_compare_func_t *cmp, void *priv) |
Perform a linear search of the array. | |
void | cstl_raw_array_sort (void *arr, size_t count, size_t size, cstl_compare_func_t *cmp, void *priv, cstl_swap_func_t *swap, void *tmp, cstl_sort_algorithm_t algo) |
Sort the array using the specified algorithm. | |