aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/cList.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cList.ml')
-rw-r--r--lib/cList.ml10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/cList.ml b/lib/cList.ml
index 36dad3235..93ba0637e 100644
--- a/lib/cList.ml
+++ b/lib/cList.ml
@@ -479,14 +479,14 @@ let rec find_map f = function
let uniquize l =
let visited = Hashtbl.create 23 in
- let rec aux acc = function
- | h::t -> if Hashtbl.mem visited h then aux acc t else
+ let rec aux acc changed = function
+ | h::t -> if Hashtbl.mem visited h then aux acc true t else
begin
Hashtbl.add visited h h;
- aux (h::acc) t
+ aux (h::acc) changed t
end
- | [] -> List.rev acc
- in aux [] l
+ | [] -> if changed then List.rev acc else l
+ in aux [] false l
(** [sort_uniquize] might be an alternative to the hashtbl-based
[uniquize], when the order of the elements is irrelevant *)