summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-03-20 11:07:25 -0500
committerJohn Estabrook <jestabro@vyos.io>2023-03-20 11:12:00 -0500
commit4c1583cd1343c4d0ba6ceae7f9a8c7637ec37790 (patch)
tree80b144e8e5658c36f27db2175422d3b40e4bf0cc
parent020716d9823a76b674ff0c820b278e10e32d686f (diff)
downloadlibvyosconfig-4c1583cd1343c4d0ba6ceae7f9a8c7637ec37790.tar.gz
libvyosconfig-4c1583cd1343c4d0ba6ceae7f9a8c7637ec37790.zip
T5089: binding for configtree tree_union
-rw-r--r--lib/bindings.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/bindings.ml b/lib/bindings.ml
index 7f6cb76..1f7ef15 100644
--- a/lib/bindings.ml
+++ b/lib/bindings.ml
@@ -201,6 +201,15 @@ let show_diff cmds path c_ptr_l c_ptr_r =
| CD.Incommensurable -> error_message := "Incommensurable"; "#1@"
| CD.Empty_comparison -> error_message := "Empty comparison"; "#1@"
+let tree_union c_ptr_l c_ptr_r =
+ let ct_l = Root.get c_ptr_l in
+ let ct_r = Root.get c_ptr_r in
+ try
+ let ct_ret = CD.tree_union ct_l ct_r in
+ Ctypes.Root.create ct_ret
+ with
+ CD.Nonexistent_child -> error_message := "Nonexistent child"; Ctypes.null
+
module Stubs(I : Cstubs_inverted.INTERNAL) =
struct
@@ -229,4 +238,5 @@ struct
let () = I.internal "diff_tree" (string @-> (ptr void) @-> (ptr void) @-> returning (ptr void)) diff_tree
let () = I.internal "trim_tree" ((ptr void) @-> (ptr void) @-> returning (ptr void)) trim_tree
let () = I.internal "show_diff" (bool @-> string @-> (ptr void) @-> (ptr void) @-> returning string) show_diff
+ let () = I.internal "tree_union" ((ptr void) @-> (ptr void) @-> returning (ptr void)) tree_union
end