.
[SXSI/xpathcomp.git] / tree.ml
diff --git a/tree.ml b/tree.ml
index c968f10..74903de 100644 (file)
--- a/tree.ml
+++ b/tree.ml
@@ -168,16 +168,9 @@ module DocIdSet = struct
                           let compare = compare_node end)
     
 end
-let is_nil t = match t.node with
-  | Nil -> true
-  | Node(i) -> equal_node i nil
-  | _ -> false
-
-let is_node t =
-match t.node with
-  | Node(i) -> not(equal_node i nil)
-  | _ -> false
+let is_nil t = t.node == Nil
 
+let is_node t = t.node != Nil
 
 let node_of_t t =
   let _ = Tag.init (Obj.magic t) in
@@ -232,7 +225,7 @@ let compare a b = match a.node,b.node  with
 let equal a b = (compare a b) == 0
   
   
-let norm (n : [`Tree ] node ) =  if tree_is_nil n then Nil else Node (n)
+let norm (n : [`Tree ] node ) =  if n == -1 then Nil else Node (n)
   
 let nts = function
     Nil -> "Nil"
@@ -279,7 +272,7 @@ let node_sibling n =
     | Node i ->  { n with node= norm(tree_next_sibling n.doc i) }
     | _ -> { n with node = Nil }
 
-let node_sibling_ctx n _ = 
+let node_sibling_ctx  n _ = 
   match n.node with
     | Node i ->  { n with node= norm(tree_next_sibling n.doc i) }
     | _ -> { n with node = Nil }