BLI_link_utils: Add BLI_LINKS_APPEND(list, link)

This commit is contained in:
Clément Foucault 2018-02-27 23:30:28 +01:00
parent 11100faa5c
commit d5a55b6918
1 changed files with 12 additions and 0 deletions

View File

@ -35,6 +35,18 @@
list = link; \
} (void)0
/* Use for append (single linked list, storing the last element). */
#define BLI_LINKS_APPEND(list, link) { \
(link)->next = NULL; \
if ((list)->first) { \
(list)->last->next = link; \
} \
else { \
(list)->first = link; \
} \
(list)->last = link; \
} (void)0
#define BLI_LINKS_FREE(list) { \
while (list) { \
void *next = list->next; \