Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-02-28 01:30:28 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-02-28 03:29:26 +0300
commitd5a55b69181a69d481b1e504f39926ec595dd6b8 (patch)
tree3ae8ead0a91741c98b5ba6856286c9a9c4e0d202 /source/blender/blenlib/BLI_link_utils.h
parent11100faa5cfbeb735194c6d2d5ed951dc5ae063a (diff)
BLI_link_utils: Add BLI_LINKS_APPEND(list, link)
Diffstat (limited to 'source/blender/blenlib/BLI_link_utils.h')
-rw-r--r--source/blender/blenlib/BLI_link_utils.h12
1 files changed, 12 insertions, 0 deletions
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; \