Use asserts in dbl_list
This commit is contained in:
@@ -93,7 +93,11 @@ def make_dbl_list(user_datatypes: Dict[CDataType, DblListData] = {}):
|
||||
source = CSource(
|
||||
name=header.name,
|
||||
decl_types=[*common_decl_types],
|
||||
includes=[CInclude(header, local=True, same_dir=True), CInclude(header="stddef.h")],
|
||||
includes=[
|
||||
CInclude(header, local=True, same_dir=True),
|
||||
CInclude(header="stddef.h"),
|
||||
CInclude(header="assert.h"),
|
||||
],
|
||||
internal_funcs=[],
|
||||
funcs=header.funcs
|
||||
)
|
||||
|
@@ -1,6 +1,4 @@
|
||||
if (!list) {{
|
||||
return;
|
||||
}}
|
||||
assert(list != NULL);
|
||||
|
||||
u64 count = list->node_count;
|
||||
for (u64 i = 0; i < count; ++i) {{
|
||||
|
@@ -1,6 +1,4 @@
|
||||
if (index >= list->node_count) {{
|
||||
return NULL;
|
||||
}}
|
||||
assert(index < list->node_count);
|
||||
|
||||
{NodeType} *output = NULL;
|
||||
{NodeType} *current = list->first;
|
||||
|
@@ -1,6 +1,4 @@
|
||||
if (!list || !node || !(node->item)) {{
|
||||
return;
|
||||
}}
|
||||
assert(list != NULL && node != NULL && (node->item) != NULL);
|
||||
|
||||
if (index == 0) {{
|
||||
wapp_{Tlower}_list_push_front(list, node);
|
||||
|
@@ -1,6 +1,8 @@
|
||||
assert(list != NULL);
|
||||
|
||||
{NodeType} *output = NULL;
|
||||
|
||||
if (!list || list->node_count == 0) {{
|
||||
if (list->node_count == 0) {{
|
||||
goto RETURN_{Tupper}_LIST_POP_BACK;
|
||||
}}
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
assert(list != NULL);
|
||||
|
||||
{NodeType} *output = NULL;
|
||||
|
||||
if (!list || list->node_count == 0) {{
|
||||
if (list->node_count == 0) {{
|
||||
goto RETURN_{Tupper}_LIST_POP_FRONT;
|
||||
}}
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
if (!list || !node || !(node->item)) {{
|
||||
return;
|
||||
}}
|
||||
assert(list != NULL && node != NULL && (node->item) != NULL);
|
||||
|
||||
{ListType} node_list = {Tlower}_node_to_list(node);
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
if (!list || !node || !(node->item)) {{
|
||||
return;
|
||||
}}
|
||||
assert(list != NULL && node != NULL && (node->item) != NULL);
|
||||
|
||||
{ListType} node_list = {Tlower}_node_to_list(node);
|
||||
|
||||
|
@@ -1,7 +1,6 @@
|
||||
assert(list != NULL);
|
||||
|
||||
{NodeType} *output = NULL;
|
||||
if (!list) {{
|
||||
goto RETURN_{Tupper}_LIST_REMOVE;
|
||||
}}
|
||||
|
||||
if (index == 0) {{
|
||||
output = wapp_{Tlower}_list_pop_front(list);
|
||||
|
Reference in New Issue
Block a user