Added return value for the node_init

- Can be used as before, but cleaner interface in parser.y
main
Øyvind Skaaden 2022-02-18 17:02:44 +01:00
parent f10d6c459c
commit 32c86018dc
1 changed files with 4 additions and 1 deletions

View File

@ -20,7 +20,8 @@ print_syntax_tree ( void )
}
void
// Changed so it returns the pointer to the new node, can be used as before, but makes the parser file cleaner
node_t*
node_init (node_t *nd, node_index_t type, void *data, uint64_t n_children, ...)
{
// Copy the type
@ -45,6 +46,8 @@ node_init (node_t *nd, node_index_t type, void *data, uint64_t n_children, ...)
// Populate the memory with pointers to children
for (int i = 0; i < n_children; i++)
nd->children[i] = va_arg(list_children, node_t*);
return nd;
}