Skip to content

Commit

Permalink
Fix the restconf deletion of leaf list items.
Browse files Browse the repository at this point in the history
Leaf list items were not being detected properly and hence not being
set to NULL when the flag SCF_F_SET_NULL was set.
  • Loading branch information
gcampbell512 committed Mar 11, 2024
1 parent a8b8fe6 commit d2bcbe2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -3890,6 +3890,19 @@ _sch_traverse_nodes (sch_node * schema, GNode * parent, int flags, int depth, in
name = NULL;
}
}
else if (!child && flags & SCH_F_SET_NULL && g_strcmp0 (name, "*") == 0)
{
xmlNode *xml = (xmlNode *) schema;

if (sch_is_leaf_list (xml->parent))
{
for (GNode *child = parent->children; child; child = child->next)
{
free (child->children->data);
child->children->data = g_strdup ("");
}
}
}
else if (child && flags & SCH_F_SET_NULL)
{
if (!(flags & SCH_F_FILTER_RDEPTH) || (depth >= rdepth))
Expand Down

0 comments on commit d2bcbe2

Please sign in to comment.