trivial diff: error handling in io__tell

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 6 00:38:14 AEDT 1998


library/io.m:
	In io__tell and io__tell_binary, if io__open_output(_binary)
	fails, then pass the resulting error back out, rather than
	recreating it.

Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.167
diff -u -r1.167 io.m
--- io.m	1998/11/05 06:48:18	1.167
+++ io.m	1998/11/05 13:26:11
@@ -2206,11 +2206,12 @@
 
 io__tell(File, Result) -->
 	io__open_output(File, Result0),
-	( { Result0 = ok(Stream) } ->
+	(
+		{ Result0 = ok(Stream) },
 		io__set_output_stream(Stream, _),
 		{ Result = ok }
 	;
-		io__make_err_msg("can't open output file: ", Msg),
+		{ Result0 = error(Msg) },
 		{ Result = error(Msg) }
 	).
 
@@ -2221,11 +2222,12 @@
 
 io__tell_binary(File, Result) -->
 	io__open_binary_output(File, Result0),
-	( { Result0 = ok(Stream) } ->
+	(
+		{ Result0 = ok(Stream) },
 		io__set_binary_output_stream(Stream, _),
 		{ Result = ok }
 	;
-		io__make_err_msg("can't open output file: ", Msg),
+		{ Result0 = error(Msg) },
 		{ Result = error(Msg) }
 	).
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list