#ifndef UCX_ARRAY_LIST_H
#define UCX_ARRAY_LIST_H
#include "list.h"
#ifdef __cplusplus
extern "C" {
#endif
struct cx_array_reallocator_s {
void *(*realloc)(
void *array,
size_t capacity,
size_t elem_size,
struct cx_array_reallocator_s *alloc
);
void *ptr1;
void *ptr2;
size_t int1;
size_t int2;
};
enum cx_array_copy_result {
CX_ARRAY_COPY_SUCCESS,
CX_ARRAY_COPY_REALLOC_NOT_SUPPORTED,
CX_ARRAY_COPY_REALLOC_FAILED,
};
enum cx_array_copy_result cx_array_copy(
void **target,
size_t *size,
size_t *capacity,
size_t index,
void const *src,
size_t elem_size,
size_t elem_count,
struct cx_array_reallocator_s *reallocator
) __attribute__((__nonnull__(
1,
2,
5)));
void cx_array_swap(
void *arr,
size_t elem_size,
size_t idx1,
size_t idx2
) __attribute__((__nonnull__));
CxList *cxArrayListCreate(
CxAllocator
const *allocator,
cx_compare_func comparator,
size_t item_size,
size_t initial_capacity
);
#define cxArrayListCreateSimple(item_size, initial_capacity) \
cxArrayListCreate(
NULL,
NULL, item_size, initial_capacity)
#ifdef __cplusplus
}
#endif
#endif