[Pkg-libvirt-commits] [libguestfs] 100/146: v2v: Move append_* functions to DOM module.

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 17:01:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit 46431b7fdbc3d864899a8cecece8dce30377f45c
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Wed Dec 24 13:32:18 2014 +0000

    v2v: Move append_* functions to DOM module.
    
    Just code motion.
    
    (cherry picked from commit 47b54a7ba5a49af33a08d47b284c664695c523ea)
---
 v2v/DOM.ml            |  8 ++++++++
 v2v/DOM.mli           | 12 ++++++++++++
 v2v/OVF.ml            |  4 ----
 v2v/output_libvirt.ml |  8 --------
 4 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/v2v/DOM.ml b/v2v/DOM.ml
index 28b056e..d1541f1 100644
--- a/v2v/DOM.ml
+++ b/v2v/DOM.ml
@@ -128,3 +128,11 @@ let find_node_by_attr nodes attr =
   match filter_node_list_by_attr nodes attr with
   | [] -> raise Not_found
   | x::_ -> x
+
+let append_attr attr = function
+  | PCData _ | Comment _ -> invalid_arg "append_attr"
+  | Element e -> e.e_attrs <- e.e_attrs @ [attr]
+
+let append_child child = function
+  | PCData _ | Comment _ -> invalid_arg "append_child"
+  | Element e -> e.e_children <- e.e_children @ [child]
diff --git a/v2v/DOM.mli b/v2v/DOM.mli
index f5a0339..e9d0108 100644
--- a/v2v/DOM.mli
+++ b/v2v/DOM.mli
@@ -51,3 +51,15 @@ val find_node_by_attr : node list -> attr -> node
 (** Find the first DOM element which has a particular attribute
     name=value (not recursively).  If not found, raises
     [Not_found]. *)
+
+val append_attr : attr -> node -> unit
+(** [element] must be an [Element _] node.  [append_attr attr element]
+    appends [attr] to the attributes of [element].
+
+    This mutates [element]. *)
+
+val append_child : node -> node -> unit
+(** [element] must be an [Element _] node.  [append_child child
+    element] appends [child] to the children of [element].
+
+    This mutates [element]. *)
diff --git a/v2v/OVF.ml b/v2v/OVF.ml
index 76e4640..4041a1e 100644
--- a/v2v/OVF.ml
+++ b/v2v/OVF.ml
@@ -298,10 +298,6 @@ let rec create_ovf verbose source targets guestcaps inspect
   (* Return the OVF document. *)
   ovf
 
-and append_child child = function
-  | PCData _ | Comment _ -> assert false
-  | Element e -> e.e_children <- e.e_children @ [child]
-
 (* This modifies the OVF DOM, adding a section for each disk. *)
 and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf =
   let references =
diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index b566c16..6445819 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -61,14 +61,6 @@ let target_features_of_capabilities_doc doc arch =
     !features
   )
 
-let append_child child = function
-  | PCData _ | Comment _  -> assert false
-  | Element e -> e.e_children <- e.e_children @ [child]
-
-let append_attr attr = function
-  | PCData _ | Comment _ -> assert false
-  | Element e -> e.e_attrs <- e.e_attrs @ [attr]
-
 let create_libvirt_xml ?pool source targets guestcaps target_features =
   let memory_k = source.s_memory /^ 1024L in
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list