1. camlspotter
  2. spotlib

Commits

camlspotter  committed c422655

Xhashtbl.of_list/to_list: accept double bindings

  • Participants
  • Parent commits 03905b2
  • Branches default

Comments (0)

Files changed (3)

File lib/xhashtbl.ml

View file
 let of_list size kvs =
   let tbl = Hashtbl.create size in
   List.iter (fun (k,v) ->
-    Hashtbl.replace tbl k v) kvs;
+    Hashtbl.add tbl k v) kvs;
   tbl
   
 let to_list tbl = Hashtbl.fold (fun k v st -> (k,v) :: st) tbl []

File lib/xhashtbl.mli

View file
 val replace_list : ('a, 'b) Hashtbl.t -> ('a * 'b) list -> unit
+
 val of_list      : int -> ('a * 'b) list -> ('a, 'b) Hashtbl.t
+(** Double bindings can be found by [Hashtbl.find_all] *)
+
 val to_list      : ('a, 'b) Hashtbl.t -> ('a * 'b) list
+
 val find_opt     : ('a, 'b) Hashtbl.t -> 'a -> 'b option
 val find_default : 'b -> ('a, 'b) Hashtbl.t -> 'a -> 'b
 val find_or_add  : ('a -> 'b) -> ('a, 'b) Hashtbl.t -> 'a -> 'b

File lib/xunix.ml

View file
   
     and find_non_dir path = try f path with Prune -> ()
       (* Even if path is a dangling symlink, f path is called *)
+      (* CR jfuruse: if the initial argument contains non existent files,
+         they reach here. *)
     in
   
     List.iter (fun fname ->