A new function to move list at the beginning of another list
This is a change of the BLI_movelisttolist but in reverse order.
This commit is contained in:
@@ -82,6 +82,7 @@ void BLI_listbase_swaplinks(struct ListBase *listbase, void *vlinka, void *vlink
|
||||
void BLI_listbases_swaplinks(struct ListBase *listbasea, struct ListBase *listbaseb, void *vlinka, void *vlinkb) ATTR_NONNULL(2, 3);
|
||||
|
||||
void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src) ATTR_NONNULL(1, 2);
|
||||
void BLI_movelisttolist_reverse(struct ListBase *dst, struct ListBase *src) ATTR_NONNULL(1, 2);
|
||||
void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1, 2);
|
||||
void BLI_listbase_reverse(struct ListBase *lb) ATTR_NONNULL(1);
|
||||
void BLI_listbase_rotate_first(struct ListBase *lb, void *vlink) ATTR_NONNULL(1, 2);
|
||||
|
||||
@@ -67,6 +67,26 @@ void BLI_movelisttolist(ListBase *dst, ListBase *src)
|
||||
src->first = src->last = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user