wickr-crypto-c
|
Functions | |
wickr_array_t * | wickr_array_new (uint32_t item_count, uint8_t item_type, wickr_array_copy_func item_copy_func, wickr_array_destroy_func item_destroy_func) |
uint32_t | wickr_array_get_item_count (const wickr_array_t *array) |
bool | wickr_array_set_item (wickr_array_t *array, uint32_t index, void *item, bool copy) |
void * | wickr_array_fetch_item (const wickr_array_t *array, uint32_t index, bool copy) |
wickr_array_t * | wickr_array_copy (const wickr_array_t *array, bool deep_copy) |
void | wickr_array_destroy (wickr_array_t **array, bool destroy_items) |
wickr_array_t* wickr_array_copy | ( | const wickr_array_t * | array, |
bool | deep_copy | ||
) |
Make a copy
array | the array that is being copied |
deep_copy | if true, items inserted into the copied array will be a deep copy of items in the original array. If false, items in the original array will be inserted into the new array without transferring ownership |
void wickr_array_destroy | ( | wickr_array_t ** | array, |
bool | destroy_items | ||
) |
Free an array
array | the array to destroy |
destroy_items | if true, the destroy function specified in 'wickr_array_create' will be called on each item in the array before destroying the array itself |
void* wickr_array_fetch_item | ( | const wickr_array_t * | array, |
uint32_t | index, | ||
bool | copy | ||
) |
Fetch an item at a specified index
array | the array from which an item will be fetched |
index | the position in the array the item will be fetched from |
copy | if true, a deep copy will be made and returned instead of the item stored in the array |
uint32_t wickr_array_get_item_count | ( | const wickr_array_t * | array | ) |
Fetch the size of the array
Note that null values in the array, or uninitialized values in the array will still be counted. The size of the array remains static after it has been created with wickr_array_new. Increasing or decreasing the size of the array is not yet supported
array | an array to get the item count of |
wickr_array_t* wickr_array_new | ( | uint32_t | item_count, |
uint8_t | item_type, | ||
wickr_array_copy_func | item_copy_func, | ||
wickr_array_destroy_func | item_destroy_func | ||
) |
Create a new array
item_count | number of items the array will hold |
item_type | an integer that will designate the type of item the array will hold. All items in the array must be of the same type |
item_copy_func | a function that will provide a deep copy of an item in the array |
item_destroy_func | a function that will provide freeing memory consumed by an item in the array |
bool wickr_array_set_item | ( | wickr_array_t * | array, |
uint32_t | index, | ||
void * | item, | ||
bool | copy | ||
) |
Assign an item to a specified index in the array
array | the array the item is being set into |
index | the position in the array the item is being set into |
item | the item that will be set in the array at the specified index |
copy | if true, a deep copy of the item will be made, and the copy will be inserted into the array |