Revised patch for libio test breakage

Zack Weinberg zack@wolery.cumb.org
Thu Jan 27 14:13:00 GMT 2000


Under glibc 2.1 in default mode a declaration of malloc is visible
after including string.h.   It clashes with the private, old-style
declaration of malloc in dbz.c and dbzmain.c.  This causes a naive
'make check' to bomb out before it ever reaches the interesting bits.

Since we attempt to provide a sensible stdlib.h even on unregenerate
K+R systems, and dbz.c/dbzmain.c are only compiled by GCC, this patch
simply nukes the private decls and includes stdlib.h unconditionally.

OK to install?

zw

	* dbz/dbz.c: Nuke private decls of malloc, calloc, free, atoi,
	atol, and errno.  Include stdlib.h.
	* dbz/dbzmain.c: Likewise.

===================================================================
Index: dbz/dbz.c
--- dbz.c	1998/02/01 12:20:12	1.2
+++ dbz.c	2000/01/27 22:10:50
@@ -27,9 +27,7 @@ if the incore facility is used.
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
-#ifndef __STDC__
-extern int errno;
-#endif
+#include <stdlib.h>
 #include <dbz.h>
 
 /*
@@ -301,13 +299,6 @@ static int debug;			/* controlled by dbz
 #else
 #define	DEBUG(args)	;
 #endif
-
-/* externals used */
-extern char *malloc();
-extern char *calloc();
-extern void free();		/* ANSI C; some old implementations say int */
-extern int atoi();
-extern long atol();
 
 /* misc. forwards */
 static long hash();
===================================================================
Index: dbz/dbzmain.c
--- dbzmain.c	1999/09/27 17:36:14	1.3
+++ dbzmain.c	2000/01/27 22:10:50
@@ -8,6 +8,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string.h>
+#include <stdlib.h>
 #include <dbz.h>
 
 #ifdef FUNNYSEEKS
@@ -73,8 +74,6 @@ extern char *rfc822ize();
 #else
 #define	rfc822ize(n)	(n)
 #endif
-
-extern char *malloc();
 
 /*
  - main - parse arguments and handle options


More information about the Gcc-patches mailing list