diff --git a/oxenstored/connection.ml b/oxenstored/connection.ml index 4ec2668..fc55309 100644 --- a/oxenstored/connection.ml +++ b/oxenstored/connection.ml @@ -317,7 +317,7 @@ let get_children_watches con path = let path = path ^ "/" in List.concat (Hashtbl.fold - (fun p w l -> if String.startswith path p then w :: l else l) + (fun p w l -> if String.starts_with ~prefix:path p then w :: l else l) con.watches [] ) diff --git a/oxenstored/logging.ml b/oxenstored/logging.ml index 29165e7..17cb1a7 100644 --- a/oxenstored/logging.ml +++ b/oxenstored/logging.ml @@ -25,7 +25,7 @@ let log_destination_of_string s = let prefix = "syslog:" in let len_prefix = String.length prefix in let len = String.length s in - if String.startswith prefix s then + if String.starts_with ~prefix s then Syslog (Syslog.facility_of_string (String.sub s len_prefix (len - len_prefix))) else @@ -435,7 +435,7 @@ let live_update () = let xb_answer ~tid ~con ~ty data = let print, level = match ty with - | Xenbus.Xb.Op.Error when String.startswith "ENOENT" data -> + | Xenbus.Xb.Op.Error when String.starts_with ~prefix:"ENOENT" data -> (!access_log_read_ops, Warn) | Xenbus.Xb.Op.Error -> (true, Warn) diff --git a/oxenstored/stdext.ml b/oxenstored/stdext.ml index 4024bfa..10a4d77 100644 --- a/oxenstored/stdext.ml +++ b/oxenstored/stdext.ml @@ -82,18 +82,6 @@ module String = struct let a = String.sub s 0 i and b = String.sub s (i + 1) (String.length s - i - 1) in a :: split ~limit:nlimit c b - - let fold_left f accu string = - let accu = ref accu in - for i = 0 to length string - 1 do - accu := f !accu string.[i] - done ; - !accu - - (** True if string 'x' starts with prefix 'prefix' *) - let startswith prefix x = - let x_l = String.length x and prefix_l = String.length prefix in - prefix_l <= x_l && String.sub x 0 prefix_l = prefix end module Unixext = struct