From 7767580e64c75a8f2742013c91f55879c15d9386 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Fri, 2 Dec 2005 12:37:15 +0000 Subject: [PATCH] ggc.h (GGC_RESIZEVEC): New. * ggc.h (GGC_RESIZEVEC): New. cp/ * parser.c (cp_lexer_new_main): Usr GGC_RESIZEVEC instead of ggc_realloc. (cp_parser_template_argument_list): Use XRESIZEVEC instead of xrealloc. * class.c (pushclass): Likewise. From-SVN: r107887 --- gcc/ChangeLog | 4 ++++ gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/class.c | 5 ++--- gcc/cp/parser.c | 4 ++-- gcc/ggc.h | 1 + 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c629b2784e5..305d1ee31549 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2005-12-02 Gabriel Dos Reis + + * ggc.h (GGC_RESIZEVEC): New. + 2005-12-02 Volker Reichelt * gcc.c (execute): Improve readability. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b0ba117ae1ae..417f277b185c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2005-12-02 Gabriel Dos Reis + + * parser.c (cp_lexer_new_main): Usr GGC_RESIZEVEC instead of + ggc_realloc. + (cp_parser_template_argument_list): Use XRESIZEVEC instead of + xrealloc. + * class.c (pushclass): Likewise. + 2005-12-02 Gabriel Dos Reis * decl2.c (get_priority_info): Use XNEW, not xmalloc. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 5c1b9e11582c..9d53e80963d3 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5382,9 +5382,8 @@ pushclass (tree type) { current_class_stack_size *= 2; current_class_stack - = xrealloc (current_class_stack, - current_class_stack_size - * sizeof (struct class_stack_node)); + = XRESIZEVEC (struct class_stack_node, current_class_stack, + current_class_stack_size); } /* Insert a new entry on the class stack. */ diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 431642255c5a..8eb4fbfcf290 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -286,7 +286,7 @@ cp_lexer_new_main (void) { space = alloc; alloc *= 2; - buffer = ggc_realloc (buffer, alloc * sizeof (cp_token)); + buffer = GGC_RESIZEVEC (cp_token, buffer, alloc); pos = buffer + space; } cp_lexer_get_preprocessor_token (lexer, pos); @@ -8934,7 +8934,7 @@ cp_parser_template_argument_list (cp_parser* parser) memcpy (arg_ary, fixed_args, sizeof (tree) * n_args); } else - arg_ary = xrealloc (arg_ary, sizeof (tree) * alloced); + arg_ary = XRESIZEVEC (tree, arg_ary, alloced); } arg_ary[n_args++] = argument; } diff --git a/gcc/ggc.h b/gcc/ggc.h index d6b2ea833b7c..d6e2303de812 100644 --- a/gcc/ggc.h +++ b/gcc/ggc.h @@ -231,6 +231,7 @@ extern void dump_ggc_loc_statistics (void); #define GGC_CNEWVEC(T, N) ((T *) ggc_alloc_cleared ((N) * sizeof(T))) #define GGC_NEWVAR(T, S) ((T *) ggc_alloc ((S))) #define GGC_CNEWVAR(T, S) ((T *) ggc_alloc_cleared ((S))) +#define GGC_RESIZEVEC(T, P, N) ((T *) ggc_realloc ((P), (N) * sizeof (T))) #define ggc_alloc_rtvec(NELT) \ ((rtvec) ggc_alloc_zone (sizeof (struct rtvec_def) + ((NELT) - 1) \ -- 2.47.2