add pointer versions of add and remove all in ptk list

This commit is contained in:
jacekpoz 2024-08-12 23:48:39 +02:00
parent b95ddb45a0
commit af3066ab7b
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -12,10 +12,14 @@
#define PTK_LIST_ADD_ALL(T, list, ...) _add_PtkList((void **)&list.data, &list.size, &list.allocated, (T []) __VA_ARGS__, sizeof((T []) __VA_ARGS__) / sizeof(T), sizeof(T))
#define PTK_LIST_ADD_ALL_P(T, list, p_elem, elem_count) _add_PtkList((void **)&list.data, &list.size, &list.allocated, p_elem, elem_count, sizeof(T))
#define PTK_LIST_REMOVE(T, list, elem) _remove_PtkList((void *)list.data, &list.size, &elem, 1, sizeof(T))
#define PTK_LIST_REMOVE_ALL(T, list, ...) _remove_PtkList((void *)list.data, &list.size, (T []) __VA_ARGS__, sizeof((T []) __VA_ARGS__) / sizeof(T), sizeof(T))
#define PTK_LIST_REMOVE_ALL_P(T, list, p_elem, elem_count) _remove_PtkList((void *)list.data, &list.size, p_elem, elem_count, sizeof(T))
#define PTK_LIST_REMOVE_AT(T, list, index) _remove_at_PtkList((void *)list.data, &list.size, index, sizeof(T))
bool _grow_PtkList(void **data, uint32_t *allocated, size_t element_size);