mirror of
https://github.com/dgibson/dtc.git
synced 2025-12-07 05:35:07 -05:00
Alter add_property() and add_child() functiosn to add to the end of their
respective linked lists. This means we no longer reverse the order or properties and subnodes when in blob or fs input modes.
This commit is contained in:
parent
cba839c728
commit
740a19a819
1 changed files with 18 additions and 2 deletions
20
livetree.c
20
livetree.c
|
|
@ -84,12 +84,28 @@ struct node *chain_node(struct node *first, struct node *list)
|
|||
|
||||
void add_property(struct node *node, struct property *prop)
|
||||
{
|
||||
node->proplist = chain_property(prop, node->proplist);
|
||||
struct property **p;
|
||||
|
||||
prop->next = NULL;
|
||||
|
||||
p = &node->proplist;
|
||||
while (*p)
|
||||
p = &((*p)->next);
|
||||
|
||||
*p = prop;
|
||||
}
|
||||
|
||||
void add_child(struct node *parent, struct node *child)
|
||||
{
|
||||
parent->children = chain_node(child, parent->children);
|
||||
struct node **p;
|
||||
|
||||
child->next_sibling = NULL;
|
||||
|
||||
p = &parent->children;
|
||||
while (*p)
|
||||
p = &((*p)->next_sibling);
|
||||
|
||||
*p = child;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue