From d5a55b69181a69d481b1e504f39926ec595dd6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 27 Feb 2018 23:30:28 +0100 Subject: BLI_link_utils: Add BLI_LINKS_APPEND(list, link) --- source/blender/blenlib/BLI_link_utils.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source') diff --git a/source/blender/blenlib/BLI_link_utils.h b/source/blender/blenlib/BLI_link_utils.h index d469b105f93..5322547ac08 100644 --- a/source/blender/blenlib/BLI_link_utils.h +++ b/source/blender/blenlib/BLI_link_utils.h @@ -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; \ -- cgit v1.2.3