Add utility to create list node from item
This commit is contained in:
parent
6fb078a868
commit
778a4da092
@ -32,6 +32,8 @@ BEGIN_C_LINKAGE
|
|||||||
|
|
||||||
DBL_LIST_DECL(void);
|
DBL_LIST_DECL(void);
|
||||||
|
|
||||||
|
#define wapp_dbl_list_node_from_item(T, ITEM_PTR) ((DBL_NODE(T)){ .item = ITEM_PTR })
|
||||||
|
|
||||||
#define wapp_dbl_list_get(T, LIST_PTR, INDEX) \
|
#define wapp_dbl_list_get(T, LIST_PTR, INDEX) \
|
||||||
(DBL_NODE(T)*)_dbl_list_get(CAST_LIST_PTR(LIST_PTR), INDEX)
|
(DBL_NODE(T)*)_dbl_list_get(CAST_LIST_PTR(LIST_PTR), INDEX)
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ Str8 *wapp_str8_join(const Allocator *allocator, const DBL_LIST(Str8)
|
|||||||
/**
|
/**
|
||||||
* Str8 list utilities
|
* Str8 list utilities
|
||||||
*/
|
*/
|
||||||
#define wapp_str8_node_from_cstr(STRING) ((DBL_NODE(Str8)){.item = &wapp_str8_lit(STRING)})
|
#define wapp_str8_node_from_cstr(STRING) wapp_dbl_list_node_from_item(Str8, &wapp_str8_lit(STRING))
|
||||||
#define wapp_str8_node_from_str8(STRING) ((DBL_NODE(Str8)){.item = &(STRING)})
|
#define wapp_str8_node_from_str8(STRING) wapp_dbl_list_node_from_item(Str8, &(STRING))
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
END_C_LINKAGE
|
END_C_LINKAGE
|
||||||
|
Loading…
Reference in New Issue
Block a user