cccp.c (xrealloc): Call malloc given a NULL old pointer.

* 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
This commit is contained in:
Richard Henderson 1999-01-21 09:47:36 -08:00 committed by Richard Henderson
parent d202e8aa05
commit 470b68c0a9
18 changed files with 147 additions and 69 deletions

View 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

View 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;

View 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

View 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;

View File

@ -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 *

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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.");

View 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);