ggc.h (GGC_RESIZEVEC): New.
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Fri, 2 Dec 2005 12:37:15 +0000 (12:37 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Fri, 2 Dec 2005 12:37:15 +0000 (12:37 +0000)
        * 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
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/parser.c
gcc/ggc.h

index 5c629b2..305d1ee 100644 (file)
@@ -1,3 +1,7 @@
+2005-12-02  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+       * ggc.h (GGC_RESIZEVEC): New.
+
 2005-12-02  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        * gcc.c (execute): Improve readability.
index b0ba117..417f277 100644 (file)
@@ -1,5 +1,13 @@
 2005-12-02  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
+       * 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  <gdr@integrable-solutions.net>
+
        * decl2.c (get_priority_info): Use XNEW, not xmalloc.
        * decl.c (push_switch): Likewise.
        * lex.c (handle_pragma_implementation): Likewise.
index 5c1b9e1..9d53e80 100644 (file)
@@ -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.  */
index 4316422..8eb4fbf 100644 (file)
@@ -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;
     }
index d6b2ea8..d6e2303 100644 (file)
--- 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)     \