From 4dc38975e12c3e9fa9e5b893ba07621575e2d375 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Sat, 20 Jun 2015 12:54:47 +0100 Subject: [PATCH] Remove 4.02 syntax for test_memory_leaks --- examples/test_memory_leaks.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/test_memory_leaks.ml b/examples/test_memory_leaks.ml index dc8b4e3..ec9bf55 100644 --- a/examples/test_memory_leaks.ml +++ b/examples/test_memory_leaks.ml @@ -11,9 +11,10 @@ let test1 () = let rss () = let path = Printf.sprintf "/proc/%d/statm" (Unix.getpid ()) in - match open_in path with - | exception exn -> Printf.eprintf "Error opening %s (%s), ignoring\n%!" path (Printexc.to_string exn); 0 - | ch -> let n = Scanf.fscanf ch "%_d %d" (fun x -> 4*1024*x) in close_in_noerr ch; n + try + let ch = open_in path in + let n = Scanf.fscanf ch "%_d %d" (fun x -> 4*1024*x) in close_in_noerr ch; n + with exn -> Printf.eprintf "Error opening %s (%s), ignoring\n%!" path (Printexc.to_string exn); 0 let () = let rss1 = rss () in -- 2.11.4.GIT