Richard W.M. Jones
2018-Jun-07 09:07 UTC
[Libguestfs] [PATCH] v2v: parse_libvirt_xml: Simplify code by using xpath_get_nodes utility fn.
No functional change. --- v2v/parse_libvirt_xml.ml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml index 57e741574..03a201e77 100644 --- a/v2v/parse_libvirt_xml.ml +++ b/v2v/parse_libvirt_xml.ml @@ -123,14 +123,8 @@ let parse_libvirt_xml ?conn xml | _, _, _ -> None in let features - let features = ref [] in - let obj = Xml.xpath_eval_expression xpathctx "/domain/features/*" in - let nr_nodes = Xml.xpathobj_nr_nodes obj in - for i = 0 to nr_nodes-1 do - let node = Xml.xpathobj_node obj i in - List.push_front (Xml.node_name node) features - done; - !features in + let nodes = xpath_get_nodes xpathctx "/domain/features/*" in + List.map Xml.node_name nodes in let display let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/graphics" in -- 2.16.2
Possibly Parallel Threads
- [PATCH v11 7/8] mllib: add XPath helper xpath_get_nodes
- Re: [PATCH v11 5/6] mllib: add XPath helper xpath_get_nodes()
- [PATCH v2] v2v: Free XML objects in the correct order.
- [PATCH] v2v: Free XML objects in the correct order.
- [PATCH v5 09/10] mllib: add XPath helper xpath_get_nodes()