From b8f1ea3fff3d7fc22d0b9a609edb345f191cb691 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 12 Jun 2016 17:35:14 +0100 Subject: [PATCH] v2v: DOM: Make 'doc' and 'element' types distinct. No functional change, just enforces the distinct type for callers. --- v2v/DOM.ml | 8 ++++---- v2v/DOM.mli | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/v2v/DOM.ml b/v2v/DOM.ml index 2729f27bc..455e7ec6c 100644 --- a/v2v/DOM.ml +++ b/v2v/DOM.ml @@ -32,10 +32,10 @@ and element = { mutable e_children : node list; (* Child elements. *) } and attr = string * string -and doc = element +and doc = Doc of element let doc name attrs children = - { e_name = name; e_attrs = attrs; e_children = children } + Doc { e_name = name; e_attrs = attrs; e_children = children } let e name attrs children = Element { e_name = name; e_attrs = attrs; e_children = children } @@ -98,12 +98,12 @@ and xml_quote_pcdata str = let str = String.replace str ">" ">" in str -let doc_to_chan chan doc = +let doc_to_chan chan (Doc doc) = fprintf chan "\n"; element_to_chan chan doc; fprintf chan "\n" -let path_to_nodes doc path = +let path_to_nodes (Doc doc) path = match path with | [] -> invalid_arg "path_to_nodes: empty path" | top_name :: path -> diff --git a/v2v/DOM.mli b/v2v/DOM.mli index 32736002d..c34bc54ee 100644 --- a/v2v/DOM.mli +++ b/v2v/DOM.mli @@ -19,7 +19,7 @@ (** Poor man's XML DOM, mutable for ease of modification. *) type element -type doc = element +type doc = Doc of element type attr = string * string type node =