From: Christoph Mallon Date: Fri, 27 May 2011 17:05:29 +0000 (+0200) Subject: Use XMALLOCF*(). X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=f685f90e74e7cd9a965865f6f7bdd9af749732e9;p=libfirm Use XMALLOCF*(). --- diff --git a/ir/lower/lower_intrinsics.c b/ir/lower/lower_intrinsics.c index 0fd31c499..d7858e994 100644 --- a/ir/lower/lower_intrinsics.c +++ b/ir/lower/lower_intrinsics.c @@ -191,8 +191,7 @@ ir_prog_pass_t *lower_intrinsics_pass( const char *name, i_record *list, size_t length, int part_block_used) { - pass_t *pass = (pass_t*)xmalloc(sizeof(*pass) + (length-1) * sizeof(pass->list[0])); - + pass_t *const pass = XMALLOCF(pass_t, list, length); memcpy(pass->list, list, sizeof(list[0]) * length); pass->length = length; pass->part_block_used = part_block_used; diff --git a/ir/tr/compound_path.c b/ir/tr/compound_path.c index 6ac2ac540..11b19eb8b 100644 --- a/ir/tr/compound_path.c +++ b/ir/tr/compound_path.c @@ -44,8 +44,7 @@ compound_graph_path *new_compound_graph_path(ir_type *tp, size_t length) assert(is_compound_type(tp) || is_Array_type(tp)); assert(length > 0); - res = (compound_graph_path*)xmalloc(sizeof(*res) + (length-1) * sizeof(res->list[0])); - memset(res, 0, sizeof(*res) + (length-1) * sizeof(res->list[0])); + res = XMALLOCFZ(compound_graph_path, list, length); res->kind = k_ir_compound_graph_path; res->tp = tp; res->len = length;