[m-rev.] diff: file descriptor leak

Peter Wang wangp at students.cs.mu.OZ.AU
Fri Feb 17 19:01:11 AEDT 2006


Estimated hours taken: 2
Branches: main

compiler/mmc_analysis.m:
	Fix a file descriptor leak with `--intermodule-analysis'.

Index: compiler/mmc_analysis.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mmc_analysis.m,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -u -r1.12 -r1.13
--- compiler/mmc_analysis.m	13 Feb 2006 03:47:43 -0000	1.12
+++ compiler/mmc_analysis.m	17 Feb 2006 07:59:28 -0000	1.13
@@ -96,7 +96,14 @@
     ModuleName = module_id_to_module_name(ModuleId),
     modules.module_name_to_search_file_name(ModuleName, Ext, FileName0, !IO),
     globals.io_lookup_accumulating_option(intermod_directories, Dirs, !IO),
-    search_for_file(Dirs, FileName0, MaybeFileName, !IO).
+    search_for_file(Dirs, FileName0, MaybeFileName, !IO),
+    (
+        MaybeFileName = ok(_),
+        % `search_for_file' actually opens the file.
+        io.seen(!IO)
+    ;
+        MaybeFileName = error(_)
+    ).
 
 :- pred mmc_module_id_to_write_file_name(module_id::in, string::in, string::out,
     io::di, io::uo) is det.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list