28 return array->num_elements;
39static int enumcmp(
const void *a,
const void *b)
51 if (aElem->
val < bElem->
val) {
53 }
else if (aElem->
val > bElem->
val) {
67 if (!array || !needle) {
73 for (i = 0; i < array->num_elements; i++) {
75 if (!enumcmp(e, needle)) {
85 if (!array || !elem) {
98 if (!array || !elem) {
122 if (!array || !del) {
128 for (
size_t i = 0; i < array->num_elements; i++) {
130 if (enumcmp(elem, del)) {
137 array->num_elements = j;
160 icalarray_sort(array, (
int (*)(
const void *,
const void *))&enumcmp);
172 for (i = 0; i < array->num_elements; i++) {
void * icalarray_element_at(icalarray *array, size_t position)
Access an array element.
void icalarray_free(icalarray *array)
void icalarray_sort(icalarray *array, int(*compare)(const void *, const void *))
Sorts the elements of an icalarray using the given comparison function.
void icalarray_append(icalarray *array, const void *element)
Appends an element to an array.
void icalarray_set_element_at(icalarray *array, const void *element, size_t position)
Overwrites an existing element in an array with a new value.
void icalarray_remove_element_at(icalarray *array, size_t position)
Removes a given element from an array.
void icalenumarray_free(icalenumarray *array)
Frees this array's memory and all its elements.
void icalenumarray_remove(icalenumarray *array, const icalenumarray_element *del)
Removes all occurrences of an element.
size_t icalenumarray_find(icalenumarray *array, const icalenumarray_element *needle)
Finds an element in the array.
void icalenumarray_sort(icalenumarray *array)
Sorts the elements in the array in ascending order.
void icalenumarray_append(icalenumarray *array, const icalenumarray_element *elem)
Appends an element to the array.
size_t icalenumarray_size(const icalenumarray *array)
Indicates the count of elements stored in the array.
icalenumarray * icalenumarray_clone(icalenumarray *array)
Clones the array and all its elements.
void icalenumarray_remove_element_at(icalenumarray *array, size_t position)
Removes the element at an array position.
const icalenumarray_element * icalenumarray_element_at(icalenumarray *array, size_t position)
Accesses an element stored in the array.
void icalenumarray_add(icalenumarray *array, const icalenumarray_element *elem)
Appends an element to the array, omitting duplicates.
Defines the data structure for handling arrays of enums.
#define icalenumarray_new(increment_size)
void icalmemory_free_buffer(void *buf)
Releases a buffer.
char * icalmemory_strdup(const char *s)
Creates a duplicate of a string.
Common memory management routines.