From 470b68c0a905424b48946238ab2016d0a720d7ae Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 21 Jan 1999 09:47:36 -0800 Subject: 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 --- gcc/genrecog.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'gcc/genrecog.c') diff --git a/gcc/genrecog.c b/gcc/genrecog.c index bcc47f0..4eb159f 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -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 -- cgit v1.1