dbxout.c (dbxout_init): Use xcalloc instead of xmalloc+bzero.
* dbxout.c (dbxout_init): Use xcalloc instead of xmalloc+bzero. * dwarf2out.c (dwarf2out_frame_init): Likewise. * final.c (shorten_branches): Likewise. * global.c (global_alloc): Likewise. * haifa-sched.c (build_control_flow): Likewise. * stmt.c (check_for_full_enumeration_handling): Likewise. (estimate_case_costs): Likewise. From-SVN: r29091
This commit is contained in:
parent
818a3b1591
commit
3de900268e
@ -1,3 +1,13 @@
|
||||
Fri Sep 3 16:22:17 1999 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
* dbxout.c (dbxout_init): Use xcalloc instead of xmalloc+bzero.
|
||||
* dwarf2out.c (dwarf2out_frame_init): Likewise.
|
||||
* final.c (shorten_branches): Likewise.
|
||||
* global.c (global_alloc): Likewise.
|
||||
* haifa-sched.c (build_control_flow): Likewise.
|
||||
* stmt.c (check_for_full_enumeration_handling): Likewise.
|
||||
(estimate_case_costs): Likewise.
|
||||
|
||||
Fri Sep 3 15:49:56 1999 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* rtl.h (RTL_CHECKC2): Fix typo in last change.
|
||||
|
@ -381,8 +381,7 @@ dbxout_init (asm_file, input_file_name, syms)
|
||||
asmfile = asm_file;
|
||||
|
||||
typevec_len = 100;
|
||||
typevec = (struct typeinfo *) xmalloc (typevec_len * sizeof typevec[0]);
|
||||
bzero ((char *) typevec, typevec_len * sizeof typevec[0]);
|
||||
typevec = (struct typeinfo *) xcalloc (typevec_len, sizeof typevec[0]);
|
||||
|
||||
/* Convert Ltext into the appropriate format for local labels in case
|
||||
the system doesn't insert underscores in front of user generated
|
||||
|
@ -1985,9 +1985,7 @@ void
|
||||
dwarf2out_frame_init ()
|
||||
{
|
||||
/* Allocate the initial hunk of the fde_table. */
|
||||
fde_table
|
||||
= (dw_fde_ref) xmalloc (FDE_TABLE_INCREMENT * sizeof (dw_fde_node));
|
||||
bzero ((char *) fde_table, FDE_TABLE_INCREMENT * sizeof (dw_fde_node));
|
||||
fde_table = (dw_fde_ref) xcalloc (FDE_TABLE_INCREMENT, sizeof (dw_fde_node));
|
||||
fde_table_allocated = FDE_TABLE_INCREMENT;
|
||||
fde_table_in_use = 0;
|
||||
|
||||
@ -10016,8 +10014,7 @@ dwarf2out_init (asm_out_file, main_input_filename)
|
||||
primary_filename = main_input_filename;
|
||||
|
||||
/* Allocate the initial hunk of the file_table. */
|
||||
file_table = (char **) xmalloc (FILE_TABLE_INCREMENT * sizeof (char *));
|
||||
bzero ((char *) file_table, FILE_TABLE_INCREMENT * sizeof (char *));
|
||||
file_table = (char **) xcalloc (FILE_TABLE_INCREMENT, sizeof (char *));
|
||||
file_table_allocated = FILE_TABLE_INCREMENT;
|
||||
|
||||
/* Skip the first entry - file numbers begin at 1. */
|
||||
@ -10025,37 +10022,29 @@ dwarf2out_init (asm_out_file, main_input_filename)
|
||||
|
||||
/* Allocate the initial hunk of the decl_die_table. */
|
||||
decl_die_table
|
||||
= (dw_die_ref *) xmalloc (DECL_DIE_TABLE_INCREMENT * sizeof (dw_die_ref));
|
||||
bzero ((char *) decl_die_table,
|
||||
DECL_DIE_TABLE_INCREMENT * sizeof (dw_die_ref));
|
||||
= (dw_die_ref *) xcalloc (DECL_DIE_TABLE_INCREMENT, sizeof (dw_die_ref));
|
||||
decl_die_table_allocated = DECL_DIE_TABLE_INCREMENT;
|
||||
decl_die_table_in_use = 0;
|
||||
|
||||
/* Allocate the initial hunk of the decl_scope_table. */
|
||||
decl_scope_table
|
||||
= (decl_scope_node *) xmalloc (DECL_SCOPE_TABLE_INCREMENT
|
||||
* sizeof (decl_scope_node));
|
||||
bzero ((char *) decl_scope_table,
|
||||
DECL_SCOPE_TABLE_INCREMENT * sizeof (decl_scope_node));
|
||||
= (decl_scope_node *) xcalloc (DECL_SCOPE_TABLE_INCREMENT,
|
||||
sizeof (decl_scope_node));
|
||||
decl_scope_table_allocated = DECL_SCOPE_TABLE_INCREMENT;
|
||||
decl_scope_depth = 0;
|
||||
|
||||
/* Allocate the initial hunk of the abbrev_die_table. */
|
||||
abbrev_die_table
|
||||
= (dw_die_ref *) xmalloc (ABBREV_DIE_TABLE_INCREMENT
|
||||
* sizeof (dw_die_ref));
|
||||
bzero ((char *) abbrev_die_table,
|
||||
ABBREV_DIE_TABLE_INCREMENT * sizeof (dw_die_ref));
|
||||
= (dw_die_ref *) xcalloc (ABBREV_DIE_TABLE_INCREMENT,
|
||||
sizeof (dw_die_ref));
|
||||
abbrev_die_table_allocated = ABBREV_DIE_TABLE_INCREMENT;
|
||||
/* Zero-th entry is allocated, but unused */
|
||||
abbrev_die_table_in_use = 1;
|
||||
|
||||
/* Allocate the initial hunk of the line_info_table. */
|
||||
line_info_table
|
||||
= (dw_line_info_ref) xmalloc (LINE_INFO_TABLE_INCREMENT
|
||||
* sizeof (dw_line_info_entry));
|
||||
bzero ((char *) line_info_table,
|
||||
LINE_INFO_TABLE_INCREMENT * sizeof (dw_line_info_entry));
|
||||
= (dw_line_info_ref) xcalloc (LINE_INFO_TABLE_INCREMENT,
|
||||
sizeof (dw_line_info_entry));
|
||||
line_info_table_allocated = LINE_INFO_TABLE_INCREMENT;
|
||||
/* Zero-th entry is allocated, but unused */
|
||||
line_info_table_in_use = 1;
|
||||
|
17
gcc/final.c
17
gcc/final.c
@ -1025,10 +1025,8 @@ shorten_branches (first)
|
||||
|
||||
max_labelno = max_label_num ();
|
||||
min_labelno = get_first_label_num ();
|
||||
label_align = (struct label_alignment *) xmalloc (
|
||||
(max_labelno - min_labelno + 1) * sizeof (struct label_alignment));
|
||||
bzero ((char *) label_align,
|
||||
(max_labelno - min_labelno + 1) * sizeof (struct label_alignment));
|
||||
label_align = (struct label_alignment **)
|
||||
xcalloc ((max_labelno - min_labelno + 1), sizeof (struct label_alignment));
|
||||
|
||||
uid_shuid = (int *) xmalloc (max_uid * sizeof *uid_shuid);
|
||||
|
||||
@ -1148,24 +1146,19 @@ shorten_branches (first)
|
||||
|
||||
/* Allocate the rest of the arrays. */
|
||||
insn_lengths = (short *) xmalloc (max_uid * sizeof (short));
|
||||
insn_addresses = (int *) xmalloc (max_uid * sizeof (int));
|
||||
insn_lengths_max_uid = max_uid;
|
||||
/* Syntax errors can lead to labels being outside of the main insn stream.
|
||||
Initialize insn_addresses, so that we get reproducible results. */
|
||||
bzero ((char *)insn_addresses, max_uid * sizeof *insn_addresses);
|
||||
uid_align = (rtx *) xmalloc (max_uid * sizeof *uid_align);
|
||||
insn_addresses = (int *) xcalloc (max_uid, sizeof (int));
|
||||
|
||||
varying_length = (char *) xmalloc (max_uid * sizeof (char));
|
||||
|
||||
bzero (varying_length, max_uid);
|
||||
varying_length = (char *) xcalloc (max_uid, sizeof (char));
|
||||
|
||||
/* Initialize uid_align. We scan instructions
|
||||
from end to start, and keep in align_tab[n] the last seen insn
|
||||
that does an alignment of at least n+1, i.e. the successor
|
||||
in the alignment chain for an insn that does / has a known
|
||||
alignment of n. */
|
||||
|
||||
bzero ((char *) uid_align, max_uid * sizeof *uid_align);
|
||||
uid_align = (rtx *) xcalloc (max_uid, sizeof *uid_align);
|
||||
|
||||
for (i = MAX_CODE_ALIGN; --i >= 0; )
|
||||
align_tab[i] = NULL_RTX;
|
||||
|
@ -486,10 +486,8 @@ global_alloc (file)
|
||||
/* We used to use alloca here, but the size of what it would try to
|
||||
allocate would occasionally cause it to exceed the stack limit and
|
||||
cause unpredictable core dumps. Some examples were > 2Mb in size. */
|
||||
conflicts = (INT_TYPE *) xmalloc (max_allocno * allocno_row_words
|
||||
* sizeof (INT_TYPE));
|
||||
bzero ((char *) conflicts,
|
||||
max_allocno * allocno_row_words * sizeof (INT_TYPE));
|
||||
conflicts = (INT_TYPE *) xcalloc (max_allocno * allocno_row_words,
|
||||
sizeof (INT_TYPE));
|
||||
|
||||
allocnos_live = (INT_TYPE *) alloca (allocno_row_words * sizeof (INT_TYPE));
|
||||
|
||||
|
@ -1085,13 +1085,9 @@ build_control_flow (s_preds, s_succs, num_preds, num_succs)
|
||||
/* Account for entry/exit edges. */
|
||||
nr_edges += 2;
|
||||
|
||||
in_edges = (int *) xmalloc (n_basic_blocks * sizeof (int));
|
||||
out_edges = (int *) xmalloc (n_basic_blocks * sizeof (int));
|
||||
bzero ((char *) in_edges, n_basic_blocks * sizeof (int));
|
||||
bzero ((char *) out_edges, n_basic_blocks * sizeof (int));
|
||||
|
||||
edge_table = (haifa_edge *) xmalloc ((nr_edges) * sizeof (haifa_edge));
|
||||
bzero ((char *) edge_table, ((nr_edges) * sizeof (haifa_edge)));
|
||||
in_edges = (int *) xcalloc (n_basic_blocks, sizeof (int));
|
||||
out_edges = (int *) xcalloc (n_basic_blocks, sizeof (int));
|
||||
edge_table = (haifa_edge *) xcalloc (nr_edges, sizeof (haifa_edge));
|
||||
|
||||
nr_edges = 0;
|
||||
for (i = 0; i < n_basic_blocks; i++)
|
||||
|
@ -4900,12 +4900,11 @@ check_for_full_enumeration_handling (type)
|
||||
bytes_needed = (size + HOST_BITS_PER_CHAR) / HOST_BITS_PER_CHAR;
|
||||
|
||||
if (size > 0 && size < 600000
|
||||
/* We deliberately use malloc here - not xmalloc. */
|
||||
&& (cases_seen = (unsigned char *) malloc (bytes_needed)) != NULL)
|
||||
/* We deliberately use calloc here - not xcalloc. */
|
||||
&& (cases_seen = (unsigned char *) calloc (bytes_needed, 1)) != NULL)
|
||||
{
|
||||
long i;
|
||||
tree v = TYPE_VALUES (type);
|
||||
bzero (cases_seen, bytes_needed);
|
||||
|
||||
/* The time complexity of this code is normally O(N), where
|
||||
N being the number of members in the enumerated type.
|
||||
@ -5469,8 +5468,7 @@ estimate_case_costs (node)
|
||||
|
||||
if (cost_table == NULL)
|
||||
{
|
||||
cost_table = ((short *) xmalloc (129 * sizeof (short))) + 1;
|
||||
bzero ((char *) (cost_table - 1), 129 * sizeof (short));
|
||||
cost_table = ((short *) xcalloc (129, sizeof (short))) + 1;
|
||||
|
||||
for (i = 0; i < 128; i++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user