aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppalloc.c
diff options
context:
space:
mode:
authorPer Bothner <bothner@gcc.gnu.org>1996-06-07 00:29:20 -0700
committerPer Bothner <bothner@gcc.gnu.org>1996-06-07 00:29:20 -0700
commit426b6fa3ab953ff01fe116eb3a29e8bb04ba0e93 (patch)
tree620a4f3abe564e35da35b5b72240936928f1121e /gcc/cppalloc.c
parentfabe72bb8921275bb23c67d5c7b66f3fcc6d9721 (diff)
downloadgcc-426b6fa3ab953ff01fe116eb3a29e8bb04ba0e93.zip
gcc-426b6fa3ab953ff01fe116eb3a29e8bb04ba0e93.tar.gz
gcc-426b6fa3ab953ff01fe116eb3a29e8bb04ba0e93.tar.bz2
cppalloc.c (memory_full): Don't use fatal; use fprintf+exit.
* cppalloc.c (memory_full): Don't use fatal; use fprintf+exit. * cppalloc.c (xcalloc): Move from here to cpplib.c. From-SVN: r12206
Diffstat (limited to 'gcc/cppalloc.c')
-rw-r--r--gcc/cppalloc.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/gcc/cppalloc.c b/gcc/cppalloc.c
index f7b6019..79d4c9b 100644
--- a/gcc/cppalloc.c
+++ b/gcc/cppalloc.c
@@ -23,11 +23,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
what you give them. Help stamp out software-hoarding! */
#include "config.h"
+#include <stdio.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 +38,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 +53,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;
-}