-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a routine to merge two GNode n_ary trees together #92
Conversation
schema.c
Outdated
char *data = NULL; | ||
|
||
if (src) | ||
data = g_strdup (src); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI - g_strdup works with NULL pointers too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - I will change the code
schema.c
Outdated
@@ -4096,6 +4107,55 @@ sch_traverse_tree (sch_instance * instance, sch_node * schema, GNode * node, int | |||
return rc; | |||
} | |||
|
|||
static void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think comments would be helpful here - I am a bit puzzled that you are doing recursive descent and deep copying?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is happening is that tree2 is being merged into tree1. The deep copying instead on moving nodes between the trees means it is much cleaner to delete tree2 when the merge is complete. I will add a comment.
7b96884
to
709576a
Compare
I was going to ask you to move the routine to apteryx.h .... oops |
The routine _sch_merge_gnode_nodes is different from apteryx_merge_tree in that it handles trees with ../* elements. This often occurs in a query (tree) which is the second tree passed to this routine. |
The _sch_traverse_nodes routine has been slightly modified to test for an exact match at depth -1. This allows netconf to test for defaults on an exact path when report-all is set.
The input trees need to be highly overlapping. This function is used by netconf to merge two GNode trees which are generated from filling in a search tree with added default values and from the initial search query with added default values.
The _sch_traverse_nodes routine has been slightly modified to allow netconf to add defaults for an input tree that is a query.