From 3cf379f70cdce611cd096a62a8f1b31bea84aab1 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 23 Dec 2004 15:29:27 +0000 Subject: [PATCH] used new xcalloc where appropriate [r4750] --- ir/ir/irdumptxt.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ir/ir/irdumptxt.c b/ir/ir/irdumptxt.c index 8a79d2471..7d6a60999 100644 --- a/ir/ir/irdumptxt.c +++ b/ir/ir/irdumptxt.c @@ -526,8 +526,7 @@ void dump_entity_to_file_prefix (FILE *F, entity *ent, char *prefix, unsigned max_depth = (depth > max_depth) ? depth : max_depth ; } - L_freq = xmalloc(sizeof(*L_freq) * 4 * max_depth); - memset(L_freq, 0, sizeof(*L_freq) * 4 * max_depth); + L_freq = xcalloc(4 * max_depth, sizeof(L_freq[0])); S_freq = L_freq + 1*max_depth; LA_freq = L_freq + 2*max_depth; @@ -643,8 +642,7 @@ void dump_entitycsv_to_file_prefix (FILE *F, entity *ent, char *prefix, unsig max_depth = (depth > max_depth) ? depth : max_depth ; } - L_freq = xmalloc(sizeof(*L_freq) * 4 * max_depth); - memset(L_freq, 0, sizeof(*L_freq) * 4 * max_depth); + L_freq = xcalloc(4 * max_depth, sizeof(L_freq[0])); S_freq = L_freq + 1*max_depth; LA_freq = L_freq + 2*max_depth; @@ -721,8 +719,7 @@ void dump_typecsv_to_file(FILE *F, type *tp, dump_verbosity verbosity, const cha max_depth = (depth > max_depth) ? depth : max_depth ; } - freq = xmalloc(sizeof(*freq) * 2 * max_depth); - memset(freq, 0, sizeof(*freq) * 2 * max_depth); + freq = xcalloc(2 * max_depth, sizeof(freq[0])); disp = freq + max_depth; @@ -848,8 +845,7 @@ void dump_type_to_file (FILE *F, type *tp, dump_verbosity verbosity) { max_depth = (depth > max_depth) ? depth : max_depth ; } - freq = xmalloc(sizeof(*freq) * max_depth); - memset(freq, 0, sizeof(*freq) * max_depth); + freq = xcalloc(max_depth, sizeof(freq[0])); for (i = 0; i < n_all; ++i) { ir_node *all = get_type_allocation(tp, i); -- 2.20.1