Skip to content

Commit

Permalink
Merge PR #1498 (fix lib.yang.list bug in remove_obsolete_nodes) into …
Browse files Browse the repository at this point in the history
…max-next
  • Loading branch information
eugeneia committed Apr 6, 2023
2 parents 16c9aa8 + 7472b83 commit cf292b2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/lib/yang/list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -829,16 +829,14 @@ function List:remove_obsolete_nodes (k, r, d, s, h)
self:free_node(r)
return self:remove_obsolete_nodes(k, node.parent, d, s, h)
elseif band(node.occupied, node.occupied-1) == 0 then
-- Node has only one child, move it to parent.
-- Node has only one child, move to parent if it is a leaf.
local index = msb_set(node.occupied)
parent.children[parent_index] = node.children[index]
if self:node_leaf(node, index) then
parent.children[parent_index] = node.children[index]
self:node_leaf(parent, parent_index, true)
else
self:node(node.children[index]).parent = node.parent
self:free_node(r)
return self:remove_obsolete_nodes(k, node.parent, d, s, h)
end
self:free_node(r)
return self:remove_obsolete_nodes(k, node.parent, d, s, h)
end
end

Expand Down

0 comments on commit cf292b2

Please sign in to comment.