Added return value for the node_init
- Can be used as before, but cleaner interface in parser.ymain
parent
f10d6c459c
commit
32c86018dc
|
@ -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, ...)
|
node_init (node_t *nd, node_index_t type, void *data, uint64_t n_children, ...)
|
||||||
{
|
{
|
||||||
// Copy the type
|
// 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
|
// Populate the memory with pointers to children
|
||||||
for (int i = 0; i < n_children; i++)
|
for (int i = 0; i < n_children; i++)
|
||||||
nd->children[i] = va_arg(list_children, node_t*);
|
nd->children[i] = va_arg(list_children, node_t*);
|
||||||
|
|
||||||
|
return nd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue