From e04bce85ae3e855b372708e93b2a9794c4819ff2 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Fri, 26 Mar 2004 09:06:32 +0000 Subject: [PATCH] BugFix: enum items idents fixed [r2565] --- ir/tr/type.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ir/tr/type.c b/ir/tr/type.c index 8fd6bfb72..32984547d 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -1318,12 +1318,10 @@ INLINE type *new_type_enumeration (ident *name, int n_enums) { int i; res = new_type(type_enumeration, NULL, name); res->attr.ea.n_enums = n_enums; - res->attr.ea.enumer = (tarval **) xmalloc (sizeof (tarval *) * n_enums); - res->attr.ea.enum_nameid = (ident **) xmalloc (sizeof (ident *) * n_enums); - for (i = 0; i < n_enums; i++) { - res->attr.ea.enumer[i] = NULL; - res->attr.ea.enum_nameid = NULL; - } + res->attr.ea.enumer = (tarval **)xmalloc(sizeof(res->attr.ea.enumer[0]) * n_enums); + res->attr.ea.enum_nameid = (ident **)xmalloc(sizeof(res->attr.ea.enum_nameid[0]) * n_enums); + memset(res->attr.ea.enumer, 0, sizeof(res->attr.ea.enumer[0]) * n_enums); + memset(res->attr.ea.enum_nameid, 0, sizeof(res->attr.ea.enum_nameid[0]) * n_enums); return res; } type *new_d_type_enumeration (ident *name, int n_enums, dbg_info* db) { -- 2.20.1