Commits

Anonymous committed d309d2f

for 4.02

  • Participants
  • Parent commits c463605
  • Branches for_4.02

Comments (0)

Files changed (4)

lib/levenshtein.ml

 
 module String = struct
 
+  open Bytes
+
   include Make(struct
     type t = string
     type elem = char
-    let compare (c1 : char) c2 = compare c1 c2
-    let get = String.unsafe_get
-    let size = String.length
+    let compare (c1 : char) c2 = Pervasives.compare c1 c2
+    let get = unsafe_get
+    let size = length
   end)
 
   TEST "Levenshtein.String slow_but_simple" =
     fun () -> Char.chr (Random.int length + offset)
 
   let random len =
-    let s = String.create len in
+    let s = create len in
     for i = 0 to len - 1 do
-      String.unsafe_set s i (random_char ())
+      unsafe_set s i (random_char ())
     done;
     s
 
   else if t = no_scan_tag     then No_scan
   else if t = abstract_tag    then Abstract
   else if t = custom_tag      then Custom
+(*
   else if t = final_tag       then Final
+*)
   else if t = out_of_heap_tag then Out_of_heap
   else if t = unaligned_tag   then Unaligned
   else Unknown t
 open Base
 
-open String (* BEWARE! compare is now for string *)
+open Bytes (* BEWARE! compare is now for string *)
 
 let index_opt s c = try Some (index s c) with Not_found -> None
 
   
   let command_aux readers stat =
     let read_buflen = 4096 in
-    let read_buf = String.create read_buflen in
+    let read_buf = Bytes.create read_buflen in
   
     let try_read_lines fd buf : (string list * bool (* eof *)) =
       let read_bytes =