37#define REDUCT_LIST_SMALL_MAX 4
38#define REDUCT_LIST_LARGE_MIN 16
39#define REDUCT_LIST_EXTRA_ROOM_FACTOR 2
42#define REDUCT_LIST_FLAG_NONE 0
43#define REDUCT_LIST_FLAG_LARGE (1 << 0)
44#define REDUCT_LIST_FLAG_USED_HEAD (1 << 1)
45#define REDUCT_LIST_FLAG_USED_TAIL (1 << 2)
51typedef struct reduct_list
uint8_t reduct_list_flags_t
REDUCT_API reduct_list_t * reduct_list_slice(struct reduct *reduct, reduct_list_t *list, size_t start, size_t end)
Create a new list by slicing an existing list.
REDUCT_API reduct_list_t * reduct_list_new(struct reduct *reduct, size_t length)
Create a new editable list.
#define REDUCT_LIST_SMALL_MAX
The maximum number of elements in a small list.
REDUCT_API reduct_list_t * reduct_list_new_handles(struct reduct *reduct, size_t count, reduct_handle_t *handles)
Create a new list from an array of handles.
REDUCT_API reduct_list_t * reduct_list_concat(struct reduct *reduct, reduct_list_t *a, reduct_list_t *b)
Create a new list by concatenating two existing lists.
REDUCT_API reduct_list_t * reduct_list_new_alist(struct reduct *reduct, size_t count,...)
Create a new association list (list storing key-value pairs) from a variable number of pairs.
REDUCT_API void reduct_list_retain(struct reduct *reduct, reduct_list_t *list)
Retain a list, preventing it from being collected by the garbage collector.
REDUCT_API reduct_list_t * reduct_list_prepend(struct reduct *reduct, reduct_list_t *list, reduct_handle_t val)
Create a new list by prepending an element to an existing list.
REDUCT_API reduct_list_t * reduct_list_append(struct reduct *reduct, reduct_list_t *list, reduct_handle_t val)
Create a new list by appending an element to an existing list.
REDUCT_API reduct_list_t * reduct_list_new_alist_entries(struct reduct *reduct, size_t count, const reduct_list_entry_t *entries)
Create a new association list from an array of entries.
REDUCT_API void reduct_list_release(struct reduct *reduct, reduct_list_t *list)
Release a list, potentially allowing the garbage collector to collect it.
A key-value pair for creating association lists.
reduct_arena_t * arena
The arena this list was allocated from.
uint32_t offset
Offset of elements from the start of the buffer.
uint32_t capacity
The current capacity of the handle buffer.
reduct_handle_t * handles
Pointer to the handle data.
_Atomic(reduct_list_flags_t) flags
List flags.
uint32_t length
The length of the list (must be first, check the reduct_item_t structure).