This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ bootstrap (part 14/n): Use XRESIZEVEC a bit more.
- From: Bernardo Innocenti <bernie at develer dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Date: Mon, 26 Jul 2004 03:26:58 +0200
- Subject: C++ bootstrap (part 14/n): Use XRESIZEVEC a bit more.
- Organization: Develer S.r.l.
As discussed in Gabriel's and RTH's reviews for patch #10.
Tested by merely recompiling the affected files and committed.
2004-07-26 Bernardo Innocenti <bernie@develer.com>
* gengtype.c (oprintf): Replace xrealloc () with XRESIZEVEC ().
* gengtype-yacc.y: Likewise. Replace free() with XDELETE ().
* c-typeck.c (PUSH_SPELLING): Remove redundant NULL-pointer
check on invocation of XRESIZEVEC ().
Index: gcc/gengtype.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype.c,v
retrieving revision 1.58
diff -u -p -r1.58 gengtype.c
--- gcc/gengtype.c 25 Jul 2004 20:43:22 -0000 1.58
+++ gcc/gengtype.c 26 Jul 2004 01:17:41 -0000
@@ -1028,7 +1028,7 @@ oprintf (outf_p o, const char *format, .
do {
new_len *= 2;
} while (o->bufused + slength >= new_len);
- o->buf = (char *) xrealloc (o->buf, new_len);
+ o->buf = XRESIZEVEC (char, o->buf, new_len);
o->buflength = new_len;
}
memcpy (o->buf + o->bufused, s, slength);
Index: gcc/gengtype-yacc.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype-yacc.y,v
retrieving revision 1.15
diff -u -p -r1.15 gengtype-yacc.y
--- gcc/gengtype-yacc.y 25 Jul 2004 20:43:22 -0000 1.15
+++ gcc/gengtype-yacc.y 26 Jul 2004 01:17:41 -0000
@@ -314,9 +314,9 @@ stringseq: STRING
{
size_t l1 = strlen ($1);
size_t l2 = strlen ($2);
- char *s = (char *) xrealloc ((char *)$1, l1 + l2 + 1);
+ char *s = XRESIZEVEC (char, $1, l1 + l2 + 1);
memcpy (s + l1, $2, l2 + 1);
- free ((void *)$2);
+ XDELETE ($2);
$$ = s;
}
;
Index: gcc/c-typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.352
diff -u -p -r1.352 c-typeck.c
--- gcc/c-typeck.c 25 Jul 2004 22:16:59 -0000 1.352
+++ gcc/c-typeck.c 26 Jul 2004 01:17:53 -0000
@@ -3755,11 +3755,8 @@ static int spelling_size; /* Size of th
if (depth >= spelling_size) \
{ \
spelling_size += 10; \
- if (spelling_base == 0) \
- spelling_base = XNEWVEC (struct spelling, spelling_size); \
- else \
- spelling_base = XRESIZEVEC (struct spelling, spelling_base, \
- spelling_size); \
+ spelling_base = XRESIZEVEC (struct spelling, spelling_base, \
+ spelling_size); \
RESTORE_SPELLING_DEPTH (depth); \
} \
\
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/