mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
builder: Old OCaml didn't have List.iteri, so add a utility function.
This commit is contained in:
@@ -50,7 +50,7 @@ let main () =
|
||||
eprintf "command line:";
|
||||
List.iter (eprintf " %s") (Array.to_list Sys.argv);
|
||||
prerr_newline ();
|
||||
List.iteri (
|
||||
iteri (
|
||||
fun i (source, fingerprint) ->
|
||||
eprintf "source[%d] = (%S, %S)\n" i source fingerprint
|
||||
) sources
|
||||
|
||||
@@ -164,6 +164,13 @@ let rec filter_map f = function
|
||||
| Some y -> y :: filter_map f xs
|
||||
| None -> filter_map f xs
|
||||
|
||||
let iteri f xs =
|
||||
let rec loop i = function
|
||||
| [] -> ()
|
||||
| x :: xs -> f i x; loop (i+1) xs
|
||||
in
|
||||
loop 0 xs
|
||||
|
||||
(* Timestamped progress messages, used for ordinary messages when not
|
||||
* --quiet.
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user