[m-dev.] diff: delete call to mercury_io_error() in runtime/mercury_file.c

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Oct 23 18:58:14 AEDT 2000


Estimated hours taken: 0.5

runtime/mercury_file.c:
	There was a call to mercury_io_error() in runtime/mercury_file.c,
	but that function was not declared.  This lead to several problems:
		- It resulted in a compiler warning.
		- Calling a variable-argument function without a prototype in
		  scope is undefined behaviour in ANSI/ISO C.
		- It breaks our policy that nothing in the runtime should
		  directly depend on anything in the library.

	In fact the call to mercury_io_error() here was not needed at all,
	since the return value of MR_UNGETCH() is checked in library/io.m.
	So the fix was just to delete the check here.

Workspace: /home/pgrad/fjh/ws/hg
Index: runtime/mercury_file.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_file.c,v
retrieving revision 1.1
diff -u -d -r1.1 mercury_file.c
--- runtime/mercury_file.c	2000/08/11 16:50:20	1.1
+++ runtime/mercury_file.c	2000/10/23 07:54:52
@@ -50,13 +50,8 @@
   int
   MR_ungetch(MR_StreamInfo *info, int ch)
   {
-	int res;
 	MR_assert(info != NULL);		
-	res = ungetc(ch, info->file);
-	if (res == EOF) {
-		mercury_io_error(NULL, "io__putback_char: ungetc failed");
-	}
-	return (int) res;
+	return ungetc(ch, info->file);
   }
 
   int

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list