98 if (listbase->
first) {
102 listbase->
last = link;
104 listbase->
first = link;
121 if (listbase->
last) {
122 ((
Link *)listbase->
last)->next = link;
125 listbase->
first = link;
127 listbase->
last = link;
148 if (listbase->
last == link) {
151 if (listbase->
first == link) {
174 Link *linka = vlinka;
175 Link *linkb = vlinkb;
177 if (!linka || !linkb) {
181 if (linkb->
next == linka) {
185 if (linka->
next == linkb) {
210 if (listbase->
last == linka) {
211 listbase->
last = linkb;
213 else if (listbase->
last == linkb) {
214 listbase->
last = linka;
217 if (listbase->
first == linka) {
218 listbase->
first = linkb;
220 else if (listbase->
first == linkb) {
221 listbase->
first = linka;
231 Link *linka = vlinka;
232 Link *linkb = vlinkb;
235 if (!linka || !linkb) {
260 if ((link = listbase->
first)) {
272 if ((link = listbase->
last)) {
299 listbase->
first = iter;
303 }
while ((iter = iter->
next));
304 listbase->
last = prev;
307 #define SORT_IMPL_LINKTYPE Link
310 #define SORT_IMPL_FUNC listbase_sort_fn
312 #undef SORT_IMPL_FUNC
315 #define SORT_IMPL_USE_THUNK
316 #define SORT_IMPL_FUNC listbase_sort_fn_r
318 #undef SORT_IMPL_FUNC
319 #undef SORT_IMPL_USE_THUNK
321 #undef SORT_IMPL_LINKTYPE
332 head = listbase_sort_fn(head, cmp);
338 int (*cmp)(
void *,
const void *,
const void *),
343 head = listbase_sort_fn_r(head, cmp, thunk);
354 Link *prevlink = vprevlink;
355 Link *newlink = vnewlink;
358 if (newlink ==
NULL) {
364 listbase->
first = newlink;
365 listbase->
last = newlink;
370 if (prevlink ==
NULL) {
374 listbase->
first = newlink;
379 if (listbase->
last == prevlink) {
380 listbase->
last = newlink;
384 newlink->
prev = prevlink;
385 prevlink->
next = newlink;
397 Link *nextlink = vnextlink;
398 Link *newlink = vnewlink;
401 if (newlink ==
NULL) {
407 listbase->
first = newlink;
408 listbase->
last = newlink;
413 if (nextlink ==
NULL) {
416 ((
Link *)listbase->
last)->next = newlink;
417 listbase->
last = newlink;
422 if (listbase->
first == nextlink) {
423 listbase->
first = newlink;
426 newlink->
next = nextlink;
428 nextlink->
prev = newlink;
443 Link *l_old = vreplacelink;
444 Link *l_new = vnewlink;
459 if (listbase->
first == l_old) {
460 listbase->
first = l_new;
462 if (listbase->
last == l_old) {
463 listbase->
last = l_new;
479 const bool is_up = step < 0;
487 const int abs_step =
abs(step);
488 for (
int i = 0; i < abs_step; i++) {
489 hook = is_up ? hook->
prev : hook->
next;
534 link = listbase->
first;
551 link = listbase->
first;
571 for (link = listbase->
first; link &&
count != count_max; link = link->
next) {
586 for (link = listbase->
first; link; link = link->
next) {
601 link = listbase->
first;
602 while (link !=
NULL && number != 0) {
619 link = listbase->
last;
620 while (link !=
NULL && number != 0) {
641 link = listbase->
first;
667 for (link = listbase->
first; link; link = link->
next) {
668 id_iter = ((
const char *)link) + offset;
670 if (
id[0] == id_iter[0] &&
STREQ(
id, id_iter)) {
687 for (link = listbase->
last; link; link = link->
prev) {
688 id_iter = ((
const char *)link) + offset;
690 if (
id[0] == id_iter[0] &&
STREQ(
id, id_iter)) {
707 for (link = listbase->
first; link; link = link->
next) {
709 id_iter = *((
const char **)(((
const char *)link) + offset));
711 if (
id[0] == id_iter[0] &&
STREQ(
id, id_iter)) {
728 for (link = listbase->
last; link; link = link->
prev) {
730 id_iter = *((
const char **)(((
const char *)link) + offset));
732 if (
id[0] == id_iter[0] &&
STREQ(
id, id_iter)) {
747 const void *ptr_iter;
749 for (link = listbase->
first; link; link = link->
next) {
751 ptr_iter = *((
const void **)(((
const char *)link) + offset));
753 if (
ptr == ptr_iter) {
768 const void *ptr_iter;
770 for (link = listbase->
last; link; link = link->
prev) {
772 ptr_iter = *((
const void **)(((
const char *)link) + offset));
774 if (
ptr == ptr_iter) {
788 const size_t bytes_size,
792 const void *ptr_iter;
794 for (link = listbase->
first; link; link = link->
next) {
795 ptr_iter = (
const void *)(((
const char *)link) + offset);
797 if (memcmp(bytes, ptr_iter, bytes_size) == 0) {
811 const size_t bytes_size,
815 const void *ptr_iter;
817 for (link = listbase->
last; link; link = link->
prev) {
818 ptr_iter = (
const void *)(((
const char *)link) + offset);
820 if (memcmp(bytes, ptr_iter, bytes_size) == 0) {
838 link = listbase->
first;
840 id_iter = ((
const char *)link) + offset;
842 if (
id[0] == id_iter[0] &&
STREQ(
id, id_iter)) {
857 struct Link *dst_link, *src_link;
860 src_link = src->
first;
867 src_link = src_link->
next;
void BLI_kdtree_nd_() free(KDTree *tree)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
These structs are the foundation for all linked lists in the library system.
Read Guarded memory(de)allocation.
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink)
void BLI_remlink(ListBase *listbase, void *vlink)
void BLI_listbase_rotate_last(ListBase *lb, void *vlink)
bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step)
void BLI_listbase_reverse(ListBase *lb)
void BLI_movelisttolist_reverse(ListBase *dst, ListBase *src)
void BLI_freelist(ListBase *listbase)
void * BLI_findstring(const ListBase *listbase, const char *id, const int offset)
void BLI_listbase_sort_r(ListBase *listbase, int(*cmp)(void *, const void *, const void *), void *thunk)
void * BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
bool BLI_listbase_move_index(ListBase *listbase, int from, int to)
void BLI_insertlinkreplace(ListBase *listbase, void *vreplacelink, void *vnewlink)
void BLI_addhead(ListBase *listbase, void *vlink)
void BLI_movelisttolist(ListBase *dst, ListBase *src)
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
int BLI_findindex(const ListBase *listbase, const void *vlink)
void BLI_listbase_sort(ListBase *listbase, int(*cmp)(const void *, const void *))
void * BLI_rfindlink(const ListBase *listbase, int number)
void * BLI_pophead(ListBase *listbase)
void * BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int offset)
void BLI_duplicatelist(ListBase *dst, const ListBase *src)
void BLI_listbase_swaplinks(ListBase *listbase, void *vlinka, void *vlinkb)
int BLI_listbase_count(const ListBase *listbase)
void * BLI_poptail(ListBase *listbase)
void BLI_listbases_swaplinks(ListBase *listbasea, ListBase *listbaseb, void *vlinka, void *vlinkb)
void BLI_freelinkN(ListBase *listbase, void *vlink)
int BLI_findstringindex(const ListBase *listbase, const char *id, const int offset)
void * BLI_listbase_bytes_find(const ListBase *listbase, const void *bytes, const size_t bytes_size, const int offset)
void BLI_freelistN(ListBase *listbase)
LinkData * BLI_genericNodeN(void *data)
void * BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
void BLI_addtail(ListBase *listbase, void *vlink)
void * BLI_listbase_bytes_rfind(const ListBase *listbase, const void *bytes, const size_t bytes_size, const int offset)
void * BLI_findlink(const ListBase *listbase, int number)
static void listbase_double_from_single(Link *iter, ListBase *listbase)
void * BLI_findstring_ptr(const ListBase *listbase, const char *id, const int offset)
void BLI_listbase_rotate_first(ListBase *lb, void *vlink)
bool BLI_remlink_safe(ListBase *listbase, void *vlink)
void * BLI_rfindstring(const ListBase *listbase, const char *id, const int offset)
int BLI_listbase_count_at_most(const ListBase *listbase, const int count_max)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
__forceinline const avxi abs(const avxi &a)