Blender V4.3
BLI_link_utils.h File Reference

Single link-list utility macros. (header only api). More...

Go to the source code of this file.

Macros

#define BLI_LINKS_PREPEND(list, link)
 
#define BLI_LINKS_APPEND(list, link)
 
#define BLI_LINKS_INSERT_AFTER(list, node, link)
 
#define BLI_LINKS_FREE(list)
 

Detailed Description

Single link-list utility macros. (header only api).

Use this api when the structure defines its own next pointer and a double linked list such as ListBase isn't needed.

Definition in file BLI_link_utils.h.

Macro Definition Documentation

◆ BLI_LINKS_APPEND

#define BLI_LINKS_APPEND ( list,
link )
Value:
{ \
(link)->next = NULL; \
if ((list)->first) { \
(list)->last->next = link; \
} \
else { \
(list)->first = link; \
} \
(list)->last = link; \
} \
(void)0
#define NULL
static ulong * next

Definition at line 24 of file BLI_link_utils.h.

Referenced by drw_command_create(), drw_shgroup_create_ex(), gpencil_layer_cache_add(), gpencil_object_cache_add(), gpencil_vfx_pass_create(), and grease_pencil_layer_cache_add().

◆ BLI_LINKS_FREE

#define BLI_LINKS_FREE ( list)
Value:
{ \
while (list) { \
void *next = (list)->next; \
MEM_freeN(list); \
list = next; \
} \
} \
(void)0

Definition at line 48 of file BLI_link_utils.h.

◆ BLI_LINKS_INSERT_AFTER

#define BLI_LINKS_INSERT_AFTER ( list,
node,
link )
Value:
{ \
if ((node)->next == NULL) { \
(list)->last = link; \
} \
(link)->next = (node)->next; \
(node)->next = link; \
} \
(void)0
OperationNode * node

Definition at line 38 of file BLI_link_utils.h.

Referenced by DRW_shgroup_create_sub().

◆ BLI_LINKS_PREPEND

#define BLI_LINKS_PREPEND ( list,
link )
Value:
{ \
CHECK_TYPE_PAIR(list, link); \
(link)->next = list; \
list = link; \
} \
(void)0

Definition at line 15 of file BLI_link_utils.h.

Referenced by drw_shgroup_uniform_create_ex(), gpu_pass_cache_insert_after(), UI_view2d_text_cache_add(), and UI_view2d_text_cache_add_rectf().