OSDN Git Service

* config/avr/avr.c (avr_init_once): Use xcalloc in lieu of
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Aug 2003 21:47:39 +0000 (21:47 +0000)
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Aug 2003 21:47:39 +0000 (21:47 +0000)
xmalloc/memset.
* config/ia64/ia64.c (ia64_reorg): Likewise.
* conflict.c (conflict_graph_new): Likewise.
* fixinc/fixincl.c (run_compiles): Likewise.
* genattrtab.c (optimize_attrs): Likewise.
* genrecog.c (new_decision): Likewise.
* haifa-sched.c (schedule_block): Likewise.
* hashtable.c (ht_create): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70337 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/avr/avr.c
gcc/config/ia64/ia64.c
gcc/conflict.c
gcc/fixinc/fixincl.c
gcc/genattrtab.c
gcc/genrecog.c
gcc/haifa-sched.c
gcc/hashtable.c

index 2d7dabe..d204bc3 100644 (file)
@@ -1,3 +1,15 @@
+2003-08-11  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * config/avr/avr.c (avr_init_once): Use xcalloc in lieu of
+       xmalloc/memset.
+       * config/ia64/ia64.c (ia64_reorg): Likewise.
+       * conflict.c (conflict_graph_new): Likewise.
+       * fixinc/fixincl.c (run_compiles): Likewise.
+       * genattrtab.c (optimize_attrs): Likewise.
+       * genrecog.c (new_decision): Likewise.
+       * haifa-sched.c (schedule_block): Likewise.
+       * hashtable.c (ht_create): Likewise.
+
 2003-08-11  Bob Wilson  <bob.wilson@acm.org>
 
        * config/xtensa/lib2funcs.S: Fix whitespace.
index 432dd53..16701d1 100644 (file)
@@ -281,20 +281,17 @@ avr_override_options ()
 void
 avr_init_once ()
 {
-  tmp_reg_rtx = xmalloc (sizeof (struct rtx_def) + 1 * sizeof (rtunion));
-  memset (tmp_reg_rtx, 0, sizeof (struct rtx_def) + 1 * sizeof (rtunion));
+  tmp_reg_rtx = xcalloc (1, sizeof (struct rtx_def) + 1 * sizeof (rtunion));
   PUT_CODE (tmp_reg_rtx, REG);
   PUT_MODE (tmp_reg_rtx, QImode);
   XINT (tmp_reg_rtx, 0) = TMP_REGNO;
 
-  zero_reg_rtx = xmalloc (sizeof (struct rtx_def) + 1 * sizeof (rtunion));
-  memset (zero_reg_rtx, 0, sizeof (struct rtx_def) + 1 * sizeof (rtunion));
+  zero_reg_rtx = xcalloc (1, sizeof (struct rtx_def) + 1 * sizeof (rtunion));
   PUT_CODE (zero_reg_rtx, REG);
   PUT_MODE (zero_reg_rtx, QImode);
   XINT (zero_reg_rtx, 0) = ZERO_REGNO;
 
-  ldi_reg_rtx = xmalloc (sizeof (struct rtx_def) + 1 * sizeof (rtunion));
-  memset (ldi_reg_rtx, 0, sizeof (struct rtx_def) + 1 * sizeof (rtunion));
+  ldi_reg_rtx = xcalloc (1, sizeof (struct rtx_def) + 1 * sizeof (rtunion));
   PUT_CODE (ldi_reg_rtx, REG);
   PUT_MODE (ldi_reg_rtx, QImode);
   XINT (ldi_reg_rtx, 0) = LDI_REG_REGNO;
index 5a10128..c3676e1 100644 (file)
@@ -7419,14 +7419,11 @@ ia64_reorg ()
       PREV_INSN (ia64_nop) = NEXT_INSN (ia64_nop) = NULL_RTX;
       recog_memoized (ia64_nop);
       clocks_length = get_max_uid () + 1;
-      stops_p = (char *) xmalloc (clocks_length);
-      memset (stops_p, 0, clocks_length);
+      stops_p = xcalloc (1, clocks_length);
       if (ia64_tune == PROCESSOR_ITANIUM)
        {
-         clocks = (int *) xmalloc (clocks_length * sizeof (int));
-         memset (clocks, 0, clocks_length * sizeof (int));
-         add_cycles = (int *) xmalloc (clocks_length * sizeof (int));
-         memset (add_cycles, 0, clocks_length * sizeof (int));
+         clocks = xcalloc (clocks_length, sizeof (int));
+         add_cycles = xcalloc (clocks_length, sizeof (int));
        }
       if (ia64_tune == PROCESSOR_ITANIUM2)
        {
index 9b63773..c832b7d 100644 (file)
@@ -160,9 +160,8 @@ conflict_graph_new (int num_regs)
   obstack_init (&graph->arc_obstack);
             
   /* Create and zero the lookup table by register number.  */
-  graph->neighbor_heads = xmalloc (num_regs * sizeof (conflict_graph_arc));
+  graph->neighbor_heads = xcalloc (num_regs, sizeof (conflict_graph_arc));
 
-  memset (graph->neighbor_heads, 0, num_regs * sizeof (conflict_graph_arc));
   return graph;
 }
 
index 2d24c17..5b92c3c 100644 (file)
@@ -481,11 +481,10 @@ run_compiles (void)
 {
   tFixDesc *p_fixd = fixDescList;
   int fix_ct = FIX_COUNT;
-  regex_t *p_re = xmalloc (REGEX_COUNT * sizeof (regex_t));
+  regex_t *p_re = xcalloc (REGEX_COUNT, sizeof (regex_t));
 
   /*  Make sure compile_re does not stumble across invalid data */
 
-  memset (p_re, '\0', REGEX_COUNT * sizeof (regex_t));
   memset (&incl_quote_re, '\0', sizeof (regex_t));
 
   compile_re (incl_quote_pat, &incl_quote_re, 1,
index 30a889c..d34fde2 100644 (file)
@@ -3393,10 +3393,8 @@ optimize_attrs (void)
     return;
 
   /* Make 2 extra elements, for "code" values -2 and -1.  */
-  insn_code_values = xmalloc ((insn_code_number + 2)
-                             * sizeof (struct attr_value_list *));
-  memset (insn_code_values, 0,
-         (insn_code_number + 2) * sizeof (struct attr_value_list *));
+  insn_code_values = xcalloc ((insn_code_number + 2),
+                             sizeof (struct attr_value_list *));
 
   /* Offset the table address so we can index by -2 or -1.  */
   insn_code_values += 2;
index 6538712..76f3749 100644 (file)
@@ -316,9 +316,8 @@ extern void debug_decision_list
 static struct decision *
 new_decision (const char *position, struct decision_head *last)
 {
-  struct decision *new = xmalloc (sizeof (struct decision));
+  struct decision *new = xcalloc (1, sizeof (struct decision));
 
-  memset (new, 0, sizeof (*new));
   new->success = *last;
   new->position = xstrdup (position);
   new->number = next_number++;
index 1043f09..c75f5ba 100644 (file)
@@ -2138,8 +2138,7 @@ schedule_block (int b, int rgn_n_insns)
     {
       /* It is used for first cycle multipass scheduling.  */
       temp_state = alloca (dfa_state_size);
-      ready_try = xmalloc ((rgn_n_insns + 1) * sizeof (char));
-      memset (ready_try, 0, (rgn_n_insns + 1) * sizeof (char));
+      ready_try = xcalloc ((rgn_n_insns + 1), sizeof (char));
       choice_stack = xmalloc ((rgn_n_insns + 1)
                              * sizeof (struct choice_entry));
       for (i = 0; i <= rgn_n_insns; i++)
index ea7d2b0..4155139 100644 (file)
@@ -58,8 +58,7 @@ ht_create (unsigned int order)
   unsigned int nslots = 1 << order;
   hash_table *table;
 
-  table = xmalloc (sizeof (hash_table));
-  memset (table, 0, sizeof (hash_table));
+  table = xcalloc (1, sizeof (hash_table));
 
   /* Strings need no alignment.  */
   _obstack_begin (&table->stack, 0, 0,