1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
$NetBSD: patch-ai,v 1.1 2002/08/10 23:22:02 rh Exp $
--- lib/xmalloc.c.orig Tue Jun 20 06:06:31 1995
+++ lib/xmalloc.c
@@ -27,10 +27,11 @@
#if !defined (ALREADY_HAVE_XMALLOC)
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
extern void *malloc (), *realloc ();
-static void memory_error_and_abort ();
+static void memory_error_and_abort (const char *);
/* **************************************************************** */
/* */
@@ -42,8 +43,7 @@
to hold BYTES number of bytes. If the memory cannot be allocated,
print an error message and abort. */
void *
-xmalloc (bytes)
- int bytes;
+xmalloc (unsigned bytes)
{
void *temp = malloc (bytes);
@@ -53,9 +53,7 @@
}
void *
-xrealloc (pointer, bytes)
- void *pointer;
- int bytes;
+xrealloc (void *pointer, unsigned bytes)
{
void *temp;
@@ -71,8 +69,7 @@
}
static void
-memory_error_and_abort (fname)
- char *fname;
+memory_error_and_abort (const char *fname)
{
fprintf (stderr, "%s: Out of virtual memory!\n", fname);
abort ();
|