texinfo 4.6.91: fix broken xmalloc

Andreas Schwab <[email protected]> Sun, 14 Mar 2004 16:35:51 +0100
Newsgroups gmane.comp.tex.texinfo.pretest
Message-ID <[email protected]>
The xmalloc implementation is not 64 bit clean.  This fixes all its
anachronisms.
 
Andreas.

2004-03-14  Andreas Schwab  <[email protected]>

	* lib/xmalloc.c: Include "system.h" instead of declaring malloc
	and realloc ourselves.
	(xmalloc): Change type of size paramter to size_t.
	(xrealloc): Likewise.

	* lib/system.h (xmalloc, xrealloc): Change type of size parameter
	to size_t.

--- lib/system.h
+++ lib/system.h
@@ -254,7 +254,7 @@
 struct passwd *getpwnam (const char *name);
 
 /* Our library routines not included in any system library.  */
-extern void *xmalloc (unsigned), *xrealloc (void *, unsigned);
+extern void *xmalloc (size_t), *xrealloc (void *, size_t);
 extern char *xstrdup (const char *);
 extern void xexit (int);
 
--- lib/xmalloc.c
+++ lib/xmalloc.c
@@ -20,11 +20,7 @@
    Written by Brian Fox ([email protected]). */
 
 #if !defined (ALREADY_HAVE_XMALLOC)
-#include <stdio.h>
-#include <sys/types.h>
-
-extern void *malloc (), *realloc ();
-static void memory_error_and_abort ();
+#include "system.h"
 
 static void
 memory_error_and_abort (const char *fname)
@@ -37,7 +33,7 @@
    to hold BYTES number of bytes.  If the memory cannot be allocated,
    print an error message and abort. */
 void *
-xmalloc (unsigned bytes)
+xmalloc (size_t bytes)
 {
   void *temp = malloc (bytes);
 
@@ -47,7 +43,7 @@
 }
 
 void *
-xrealloc (void *pointer, unsigned bytes)
+xrealloc (void *pointer, size_t bytes)
 {
   void *temp;
 

-- 
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
_______________________________________________
Texinfo home page: http://www.gnu.org/software/texinfo/
[email protected]
http://ff0.org/mailman/listinfo/texinfo-pretest