add PTK_LIST_GROW
This commit is contained in:
parent
7dc9a329ad
commit
3a2a80f70a
1 changed files with 6 additions and 2 deletions
|
@ -23,11 +23,15 @@
|
||||||
|
|
||||||
#define PTK_LIST_REMOVE_AT(T, list, index) _remove_at_PtkList((void *)list.data, &list.size, index, sizeof(T))
|
#define PTK_LIST_REMOVE_AT(T, list, index) _remove_at_PtkList((void *)list.data, &list.size, index, sizeof(T))
|
||||||
|
|
||||||
#define PTK_LIST_SET(T, list, index, elem) do {\
|
#define PTK_LIST_GROW(T, list, new_size) do {\
|
||||||
while (list.allocated <= index) {\
|
while (list.allocated < new_size) {\
|
||||||
/* let's hope this doesn't fail !!! */\
|
/* let's hope this doesn't fail !!! */\
|
||||||
_grow_PtkList((void *)&list.data, &list.allocated, sizeof(T));\
|
_grow_PtkList((void *)&list.data, &list.allocated, sizeof(T));\
|
||||||
}\
|
}\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define PTK_LIST_SET(T, list, index, elem) do {\
|
||||||
|
PTK_LIST_GROW(T, list, index + 1);\
|
||||||
list.data[index] = elem;\
|
list.data[index] = elem;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue