summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/cppalloc.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1999-08-26 09:30:50 +0000
committerobrien <obrien@FreeBSD.org>1999-08-26 09:30:50 +0000
commit0bedf4fb30066e5e1d4342a1d3914dae7d37cba7 (patch)
tree68d8110b41afd0ebbf39167b1a4918eea667a7c5 /contrib/gcc/cppalloc.c
parentd4db5fb866b7ad5216abd5047774a3973b9901a9 (diff)
downloadFreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.zip
FreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.tar.gz
Virgin import of gcc from EGCS 1.1.2
Diffstat (limited to 'contrib/gcc/cppalloc.c')
-rw-r--r--contrib/gcc/cppalloc.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/contrib/gcc/cppalloc.c b/contrib/gcc/cppalloc.c
index f7b6019..bd3a605 100644
--- a/contrib/gcc/cppalloc.c
+++ b/contrib/gcc/cppalloc.c
@@ -1,7 +1,7 @@
/* Part of CPP library. (memory allocation - xmalloc etc)
- Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1986, 87, 89, 92 - 95, 1998 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
- Based on CCCP program by by Paul Rubin, June 1986
+ Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
This program is free software; you can redistribute it and/or modify it
@@ -23,11 +23,15 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
what you give them. Help stamp out software-hoarding! */
#include "config.h"
+#include "system.h"
+#include "gansidecl.h"
+#include "cpplib.h"
static void
memory_full ()
{
- fatal ("Memory exhausted.");
+ fprintf (stderr, "%s: Memory exhausted.\n", progname);
+ exit (FATAL_EXIT_CODE);
}
char *
@@ -35,10 +39,9 @@ xmalloc (size)
unsigned size;
{
register char *ptr = (char *) malloc (size);
- if (ptr != 0) return (ptr);
- memory_full ();
- /*NOTREACHED*/
- return 0;
+ if (ptr == 0)
+ memory_full ();
+ return ptr;
}
char *
@@ -51,14 +54,3 @@ xrealloc (old, size)
memory_full ();
return ptr;
}
-
-char *
-xcalloc (number, size)
- unsigned number, size;
-{
- register unsigned total = number * size;
- register char *ptr = (char *) calloc (number, size);
- if (ptr == 0)
- memory_full ();
- return ptr;
-}
OpenPOWER on IntegriCloud