From ccf271082d8d1e6549a97bfa5349b563ab4efcd9 Mon Sep 17 00:00:00 2001 From: David Scott Date: Tue, 12 Oct 2010 12:07:32 +0100 Subject: [PATCH] CA-44731: Rewrite file_lines_iter in terms of file_lines_fold. Signed-off-by: David Scott --- stdext/unixext.ml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/stdext/unixext.ml b/stdext/unixext.ml index 1e6c274..1e162cd 100644 --- a/stdext/unixext.ml +++ b/stdext/unixext.ml @@ -98,16 +98,7 @@ let file_lines_fold f start file_path = (fun () -> fold start) (fun () -> close_in input) -let file_lines_iter f file_path = - let input = open_in file_path in - try - while true do - let line = input_line input in - f line - done - with - | End_of_file -> close_in input - | exn -> close_in input; raise exn +let file_lines_iter f file_path = file_lines_fold (fun () line -> ignore(f line)) () file_path let readfile_line = file_lines_iter -- 2.39.5