71 if (listbase->
first) {
75 listbase->
last = link;
77 listbase->
first = link;
92 ((
Link *)listbase->
last)->next = link;
95 listbase->
first = link;
97 listbase->
last = link;
115 if (listbase->
last == link) {
118 if (listbase->
first == link) {
135 Link *linka = vlinka;
136 Link *linkb = vlinkb;
138 if (!linka || !linkb) {
142 if (linkb->
next == linka) {
146 if (linka->
next == linkb) {
171 if (listbase->
last == linka) {
172 listbase->
last = linkb;
174 else if (listbase->
last == linkb) {
175 listbase->
last = linka;
178 if (listbase->
first == linka) {
179 listbase->
first = linkb;
181 else if (listbase->
first == linkb) {
182 listbase->
first = linka;
188 Link *linka = vlinka;
189 Link *linkb = vlinkb;
192 if (!linka || !linkb) {
197 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 1201
198 # pragma GCC diagnostic push
199 # pragma GCC diagnostic ignored "-Wdangling-pointer"
205 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 1201
206 # pragma GCC diagnostic pop
224 if ((link = listbase->
first)) {
233 if ((link = listbase->
last)) {
257 listbase->
first = iter;
261 }
while ((iter = iter->
next));
265 #define SORT_IMPL_LINKTYPE Link
268 #define SORT_IMPL_FUNC listbase_sort_fn
270 #undef SORT_IMPL_FUNC
273 #define SORT_IMPL_USE_THUNK
274 #define SORT_IMPL_FUNC listbase_sort_fn_r
276 #undef SORT_IMPL_FUNC
277 #undef SORT_IMPL_USE_THUNK
279 #undef SORT_IMPL_LINKTYPE
285 head = listbase_sort_fn(head, cmp);
291 int (*cmp)(
void *,
const void *,
const void *),
296 head = listbase_sort_fn_r(head, cmp, thunk);
303 Link *prevlink = vprevlink;
304 Link *newlink = vnewlink;
307 if (newlink ==
NULL) {
313 listbase->
first = newlink;
314 listbase->
last = newlink;
319 if (prevlink ==
NULL) {
323 listbase->
first = newlink;
328 if (listbase->
last == prevlink) {
329 listbase->
last = newlink;
333 newlink->
prev = prevlink;
334 prevlink->
next = newlink;
342 Link *nextlink = vnextlink;
343 Link *newlink = vnewlink;
346 if (newlink ==
NULL) {
352 listbase->
first = newlink;
353 listbase->
last = newlink;
358 if (nextlink ==
NULL) {
361 ((
Link *)listbase->
last)->next = newlink;
362 listbase->
last = newlink;
367 if (listbase->
first == nextlink) {
368 listbase->
first = newlink;
371 newlink->
next = nextlink;
373 nextlink->
prev = newlink;
381 Link *l_old = vreplacelink;
382 Link *l_new = vnewlink;
397 if (listbase->
first == l_old) {
398 listbase->
first = l_new;
400 if (listbase->
last == l_old) {
401 listbase->
last = l_new;
409 const bool is_up = step < 0;
417 const int abs_step =
abs(step);
418 for (
int i = 0; i < abs_step; i++) {
419 hook = is_up ? hook->
prev : hook->
next;
456 link = listbase->
first;
470 link = listbase->
first;
485 for (link = listbase->
first; link &&
count != count_max; link = link->
next) {
497 for (link = listbase->
first; link; link = link->
next) {
509 link = listbase->
first;
510 while (link !=
NULL && number != 0) {
524 link = listbase->
last;
525 while (link !=
NULL && number != 0) {
540 while (link !=
NULL && number != 0) {
558 link = listbase->
first;
580 for (link = listbase->
first; link; link = link->
next) {
581 id_iter = ((
const char *)link) +
offset;
583 if (
id[0] == id_iter[0] &&
STREQ(
id, id_iter)) {
597 for (link = listbase->
last; link; link = link->
prev) {
598 id_iter = ((
const char *)link) +
offset;
600 if (
id[0] == id_iter[0] &&
STREQ(
id, id_iter)) {
613 for (link = listbase->
first; link; link = link->
next) {
615 id_iter = *((
const char **)(((
const char *)link) +
offset));
617 if (
id[0] == id_iter[0] &&
STREQ(
id, id_iter)) {
631 for (link = listbase->
last; link; link = link->
prev) {
633 id_iter = *((
const char **)(((
const char *)link) +
offset));
635 if (
id[0] == id_iter[0] &&
STREQ(
id, id_iter)) {
646 const void *ptr_iter;
648 for (link = listbase->
first; link; link = link->
next) {
650 ptr_iter = *((
const void **)(((
const char *)link) +
offset));
652 if (
ptr == ptr_iter) {
664 const void *ptr_iter;
666 for (link = listbase->
last; link; link = link->
prev) {
668 ptr_iter = *((
const void **)(((
const char *)link) +
offset));
670 if (
ptr == ptr_iter) {
680 const size_t bytes_size,
684 const void *ptr_iter;
686 for (link = listbase->
first; link; link = link->
next) {
687 ptr_iter = (
const void *)(((
const char *)link) +
offset);
689 if (memcmp(bytes, ptr_iter, bytes_size) == 0) {
698 const size_t bytes_size,
704 const void *ptr_iter;
706 for (link = listbase->
last; link; link = link->
prev) {
707 ptr_iter = (
const void *)(((
const char *)link) +
offset);
709 if (memcmp(bytes, ptr_iter, bytes_size) == 0) {
719 const size_t string_offset,
726 for (link = listbase->
first, index_iter = 0; link; link = link->
next, index_iter++) {
727 if (
string !=
NULL &&
string[0] !=
'\0') {
728 const char *string_iter = ((
const char *)link) + string_offset;
730 if (
string[0] == string_iter[0] &&
STREQ(
string, string_iter)) {
734 if (index_iter == index) {
735 link_at_index = link;
738 return link_at_index;
747 link = listbase->
first;
749 id_iter = ((
const char *)link) +
offset;
751 if (
id[0] == id_iter[0] &&
STREQ(
id, id_iter)) {
763 ListBase list = {some_link, some_link};
764 if (some_link ==
NULL) {
783 struct Link *dst_link, *src_link;
786 src_link =
src->first;
793 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.
SyclQueue void void * src
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink)
void BLI_remlink(ListBase *listbase, void *vlink)
void * BLI_listbase_string_or_index_find(const ListBase *listbase, const char *string, const size_t string_offset, const int index)
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_findlinkfrom(Link *start, int number)
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)
ListBase BLI_listbase_from_link(Link *some_link)
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)
SymEdge< T > * prev(const SymEdge< T > *se)