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:
authorAntonioya <blendergit@gmail.com>2018-09-29 17:39:45 +0300
committerAntonioya <blendergit@gmail.com>2018-09-29 17:45:33 +0300
commit2ca67de9609e297ed608469fd6a0d3a9dd9cad2f (patch)
tree1244e9ba55ffb4a0eee669f39822b239f37092b0 /source/blender/blenlib/intern/listbase.c
parent0f9b7560db36eaf1ce4d7e3e0c116f2f39e3227c (diff)
A new function to move list at the beginning of another list
This is a change of the BLI_movelisttolist but in reverse order.
Diffstat (limited to 'source/blender/blenlib/intern/listbase.c')
-rw-r--r--source/blender/blenlib/intern/listbase.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index 80b8a8d041c..da187fbd19d 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -68,6 +68,26 @@ void BLI_movelisttolist(ListBase *dst, ListBase *src)
}
/**
+ * moves the entire contents of \a src at the begining of \a dst.
+ */
+void BLI_movelisttolist_reverse(ListBase *dst, ListBase *src)
+{
+ if (src->first == NULL) return;
+
+ if (dst->first == NULL) {
+ dst->first = src->first;
+ dst->last = src->last;
+ }
+ else {
+ ((Link *)src->last)->next = dst->first;
+ ((Link *)dst->first)->prev = src->last;
+ dst->first = src->first;
+ }
+
+ src->first = src->last = NULL;
+}
+
+/**
* Prepends \a vlink (assumed to begin with a Link) onto listbase.
*/
void BLI_addhead(ListBase *listbase, void *vlink)