]> gcc.gnu.org Git - gcc.git/commitdiff
cccp.c (xrealloc): Call malloc given a NULL old pointer.
authorRichard Henderson <rth@cygnus.com>
Thu, 21 Jan 1999 17:47:36 +0000 (09:47 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 21 Jan 1999 17:47:36 +0000 (09:47 -0800)
        * cccp.c (xrealloc): Call malloc given a NULL old pointer.
        * collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise.
        * gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
        * genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise.
        * genrecog.c, mips-tfile.c, protoize.c: Likewise.

From-SVN: r24806

18 files changed:
gcc/ChangeLog
gcc/cccp.c
gcc/collect2.c
gcc/cppalloc.c
gcc/gcc.c
gcc/genattr.c
gcc/genattrtab.c
gcc/gencodes.c
gcc/genconfig.c
gcc/genemit.c
gcc/genextract.c
gcc/genflags.c
gcc/genopinit.c
gcc/genoutput.c
gcc/genpeep.c
gcc/genrecog.c
gcc/mips-tfile.c
gcc/protoize.c

index 67dad253e445d17d95481458956c3a61a734728f..eb38b7e16d1d5fa269652277a6ca6c5256ed043b 100644 (file)
@@ -1,3 +1,13 @@
+Thu Jan 21 17:45:18 1999  Richard Henderson  <rth@cygnus.com>
+
+       * configure.in ({rs6000|powerpc}-ibm-aix4.[12]*): Add missing `then'.
+
+       * cccp.c (xrealloc): Call malloc given a NULL old pointer.
+       * collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise.
+       * gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
+       * genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise.
+       * genrecog.c, mips-tfile.c, protoize.c: Likewise.
+
 Thu Jan 21 19:44:55 1999  Michael Meissner  <meissner@cygnus.com>
 
        * configure.in ({rs6000|powerpc}-ibm-aix4.[12]*): If
index 39f2dac3580f5e84a327b4144a6fd01f2962c2ab..166c6ad1fc74159090ba92e57f2b8def8c7839ca 100644 (file)
@@ -10743,7 +10743,11 @@ xrealloc (old, size)
   PTR old;
   size_t size;
 {
-  register PTR ptr = (PTR) realloc (old, size);
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
   if (!ptr)
     memory_full ();
   return ptr;
index 2184e0e23983093d2e43f8c06a4bf8da9788c742..36b4cd16f0b44d59ae09e093df85d5d8ed0a67c9 100644 (file)
@@ -531,14 +531,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR value = (PTR) realloc (ptr, size);
-  if (value == 0)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (ptr == 0)
     fatal ("virtual memory exhausted");
-  return value;
+  return ptr;
 }
 
 int
index 880a56dba62752dbd8da9507326b226b12203ee1..07b6ce18a2fd20cecf83fa71ddd73eee69801290 100644 (file)
@@ -60,7 +60,11 @@ xrealloc (old, size)
   PTR old;
   size_t size;
 {
-  register PTR ptr = (PTR) realloc (old, size);
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
   if (ptr == 0)
     memory_full ();
   return ptr;
index 79ad1c38527a071928c86538be9a8114152d2e9c..673cc275460d2edbb937eaa9d27535c381eaa149 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -5219,14 +5219,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR value = (PTR) realloc (ptr, size);
-  if (value == 0)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (ptr == 0)
     fatal ("virtual memory exhausted");
-  return value;
+  return ptr;
 }
 
 static char *
index b676be5140fc4601dd654b919e9ba1cf65458c29..348de94018e7e5b7c6b04d8aac249f33e0b5925c 100644 (file)
@@ -210,14 +210,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 static void
index fc2f8840b1e53a95f47fa806fd7240578bd7b03b..cfe2757a6c14366d7f69a986c14b39a7ec3396e7 100644 (file)
@@ -5753,14 +5753,18 @@ extend_range (range, min, max)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 PTR
index 60659e3d7f149d788bec4e8f7ddbc34244ee48f8..ca67dc3062539ee7e15a14cb15ec892c2e0a45ad 100644 (file)
@@ -68,14 +68,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 static void
index 6a72e263da0d0ed84e61dd1725c9eca5e1373b82..60c0e97d6bd55c2b4e346fde10b7716d9fbbd748 100644 (file)
@@ -257,14 +257,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 static void
index 81eefa96cbcd135cfb261651f9ce4675fab3c4c9..ed7cd05be493307f4769318e200f79ab0b77fdf8 100644 (file)
@@ -691,14 +691,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 static void
index 8c54f613f5be9b54c80054a6b852b4d1c26dd4c2..a6ae3dfdbae618888e5687aa5677d636943ca76a 100644 (file)
@@ -356,14 +356,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 static void
index 043cd30f8e9882843b0eebb96b8b0304a322dbcd..0d97f387c4a3592565c8684df0336f056fd8f3de 100644 (file)
@@ -188,14 +188,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 static void
index 2b11c72549f2cce144007141e5c25dfcb0f8f6a6..5c6524f671ad846e0982cb09a4dcc66a95a303a3 100644 (file)
@@ -293,14 +293,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 static void
index 04667fee0ee7c5a1958e96d183db4a9ddf425513..c76a45181e8f01bcf06564bd020a691da2d210a5 100644 (file)
@@ -914,14 +914,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 static void
index 4330b48dd8d5c1ef3295338015b565989a697b7a..50c86a941c30bac28661d31b73da664280581663 100644 (file)
@@ -396,14 +396,18 @@ xmalloc (size)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 static void
index bcc47f0a6d3910fa7fe4d8cc1d5e55ecc9985677..4eb159fe799586fd6ecafbff83a0c142c7c0330a 100644 (file)
@@ -1671,14 +1671,18 @@ xstrdup (input)
 }
 
 PTR
-xrealloc (ptr, size)
-  PTR ptr;
+xrealloc (old, size)
+  PTR old;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
-  if (!result)
+  register PTR ptr;
+  if (ptr)
+    ptr = (PTR) realloc (old, size);
+  else
+    ptr = (PTR) malloc (size);
+  if (!ptr)
     fatal ("virtual memory exhausted");
-  return result;
+  return ptr;
 }
 
 PTR
index 95683f34eecf79bd2bfeeacd2bb5c8132ee7a27d..588f4efedc38c91879cea3b5b4b313ff480fbbad 100644 (file)
@@ -5710,7 +5710,11 @@ xrealloc (ptr, size)
   PTR ptr;
   size_t size;
 {
-  register PTR result = (PTR) realloc (ptr, size);
+  register PTR result;
+  if (ptr)
+    result = (PTR) realloc (ptr, size);
+  else
+    result = (PTR) malloc (size);
   if (!result)
     fatal ("Virtual memory exhausted.");
 
index 44c2dbe66760b6acbd1061c1936aca0b9421208c..4979c04c14fad0c4df63ebf5b25ff6f6cda42d99 100644 (file)
@@ -608,7 +608,11 @@ xrealloc (old_space, byte_count)
      pointer_type old_space;
      size_t byte_count;
 {
-  register pointer_type rv = (pointer_type) realloc (old_space, byte_count);
+  register pointer_type rv;
+  if (old_space)
+    rv = (pointer_type) realloc (old_space, byte_count);
+  else
+    rv = (pointer_type) malloc (byte_count);
   if (rv == NULL)
     {
       fprintf (stderr, "\n%s: virtual memory exceeded\n", pname);
This page took 0.117878 seconds and 5 git commands to generate.