[Bf-blender-cvs] [d5a55b69181] blender2.8: BLI_link_utils: Add BLI_LINKS_APPEND(list, link)

Clément Foucault noreply at git.blender.org
Wed Feb 28 01:39:18 CET 2018


Commit: d5a55b69181a69d481b1e504f39926ec595dd6b8
Author: Clément Foucault
Date:   Tue Feb 27 23:30:28 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBd5a55b69181a69d481b1e504f39926ec595dd6b8

BLI_link_utils: Add BLI_LINKS_APPEND(list, link)

===================================================================

M	source/blender/blenlib/BLI_link_utils.h

===================================================================

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; \



More information about the Bf-blender-cvs mailing list