libio/dbz won't compile (patch)

Zack Weinberg zack@wolery.cumb.org
Thu Jan 20 10:35:00 GMT 2000


Recently dbz stopped compiling, which of course aborts 'make check' at
the very beginning of its run.  The problem is a type clash between
its private declaration of malloc() and the standard library.

This patch fixes it for me.  I would call it an obvious bugfix but no
one else has reported this - is it just me?

zw

	* dbz.c, dbzmain.c: Get malloc and friends from stdlib.h if
	__STDC__ is defined.

===================================================================
Index: libio/dbz/dbz.c
--- libio/dbz/dbz.c	1998/02/01 12:20:12	1.2
+++ libio/dbz/dbz.c	2000/01/20 18:34:19
@@ -303,11 +303,15 @@ static int debug;			/* controlled by dbz
 #endif
 
 /* externals used */
+#ifdef __STDC__
+#include <stdlib.h>
+#else
 extern char *malloc();
 extern char *calloc();
 extern void free();		/* ANSI C; some old implementations say int */
 extern int atoi();
 extern long atol();
+#endif
 
 /* misc. forwards */
 static long hash();
===================================================================
Index: libio/dbz/dbzmain.c
--- libio/dbz/dbzmain.c	1999/09/27 17:36:14	1.3
+++ libio/dbz/dbzmain.c	2000/01/20 18:34:19
@@ -74,7 +74,12 @@ extern char *rfc822ize();
 #define	rfc822ize(n)	(n)
 #endif
 
+#ifdef __STDC__
+#include <stdlib.h>
+#else
 extern char *malloc();
+#endif
+
 
 /*
  - main - parse arguments and handle options



More information about the Gcc-patches mailing list