OSDN Git Service

* lex.c (ffelex_hash_): Avoid eating one whole line after
[pf3gnuchains/gcc-fork.git] / gcc / f / malloc.c
index 4560211..032c2bf 100644 (file)
@@ -1,6 +1,6 @@
 /* malloc.c -- Implementation File (module.c template V1.0)
    Copyright (C) 1995 Free Software Foundation, Inc.
-   Contributed by James Craig Burley (burley@gnu.org).
+   Contributed by James Craig Burley.
 
 This file is part of GNU Fortran.
 
@@ -33,10 +33,6 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "proj.h"
 #include "malloc.h"
 
-/* Assume gcc/toplev.o is linked in.  */
-void *xmalloc (unsigned size);
-void *xrealloc (void *ptr, int size);
-
 /* Externals defined here.  */
 
 struct _malloc_root_ malloc_root_
@@ -52,6 +48,8 @@ struct _malloc_root_ malloc_root_
     0,
 #if MALLOC_DEBUG
     0, 0, 0, 0, 0, 0, 0, { '/' }
+#else
+    { 0 }
 #endif
   },
 };
@@ -72,7 +70,7 @@ struct _malloc_root_ malloc_root_
 
 static void *malloc_reserve_ = NULL;   /* For crashes. */
 #if MALLOC_DEBUG
-static char *malloc_types_[] =
+static const char *malloc_types_[] =
 {"KS", "KSR", "NF", "NFR", "US", "USR"};
 #endif
 
@@ -142,8 +140,7 @@ malloc_init ()
 {
   if (malloc_reserve_ != NULL)
     return;
-  malloc_reserve_ = malloc (20 * 1024);        /* In case of crash, free this first. */
-  assert (malloc_reserve_ != NULL);
+  malloc_reserve_ = xmalloc (20 * 1024); /* In case of crash, free this first. */
 }
 
 /* malloc_pool_display -- Display a pool
@@ -236,7 +233,7 @@ malloc_pool_kill (mallocPool p)
    Makes a new pool with the given name and default new-chunk allocation.  */
 
 mallocPool
-malloc_pool_new (char *name, mallocPool parent,
+malloc_pool_new (const char *name, mallocPool parent,
                 unsigned long chunks UNUSED)
 {
   mallocPool p;
@@ -386,7 +383,7 @@ malloc_new_ (mallocSize s)
    add it to the list of mallocArea_s for the pool.  */
 
 void *
-malloc_new_inpool_ (mallocPool pool, mallocType_ type, char *name, mallocSize s)
+malloc_new_inpool_ (mallocPool pool, mallocType_ type, const char *name, mallocSize s)
 {
   void *ptr;
   mallocArea_ a;
@@ -439,7 +436,7 @@ malloc_new_inpool_ (mallocPool pool, mallocType_ type, char *name, mallocSize s)
    you pass it a 0).  */
 
 void *
-malloc_new_zinpool_ (mallocPool pool, mallocType_ type, char *name, mallocSize s,
+malloc_new_zinpool_ (mallocPool pool, mallocType_ type, const char *name, mallocSize s,
                     int z)
 {
   void *ptr;