Skip to content

Commit

Permalink
configtree: T5316: use single-pass to drop trim function
Browse files Browse the repository at this point in the history
  • Loading branch information
jestabro committed Jul 28, 2023
1 parent 2015717 commit e310cb6
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions python/vyos/configtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,6 @@ def __init__(self, left, right, path=[], libpath=LIBPATH):
self.__diff_tree.argtypes = [c_char_p, c_void_p, c_void_p]
self.__diff_tree.restype = c_void_p

self.__trim_tree = self.__lib.trim_tree
self.__trim_tree.argtypes = [c_void_p, c_void_p]
self.__trim_tree.restype = c_void_p

check_path(path)
path_str = " ".join(map(str, path)).encode()

Expand All @@ -435,11 +431,7 @@ def __init__(self, left, right, path=[], libpath=LIBPATH):
self.add = self.full.get_subtree(['add'])
self.sub = self.full.get_subtree(['sub'])
self.inter = self.full.get_subtree(['inter'])

# trim sub(-tract) tree to get delete tree for commands
ref = self.right.get_subtree(path, with_node=True) if path else self.right
res = self.__trim_tree(self.sub._get_config(), ref._get_config())
self.delete = ConfigTree(address=res)
self.delete = self.full.get_subtree(['del'])

def to_commands(self):
add = self.add.to_commands()
Expand Down

0 comments on commit e310cb6

Please sign in to comment.