try to avoid aliasing of pointers enum {} vs int

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21503 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2007-07-12 11:57:19 +00:00
parent 22621903bc
commit 6304d68d16
3 changed files with 19 additions and 18 deletions

View File

@@ -262,12 +262,14 @@ decode_type (const char *name, const Type *t, int optional,
}
case TInteger:
if(t->members) {
char *s;
asprintf(&s, "(int*)%s", name);
if (s == NULL)
errx (1, "out of memory");
decode_primitive ("integer", s, forwstr);
free(s);
fprintf(codefile,
"{\n"
"int enumint;\n");
decode_primitive ("integer", "&enumint", forwstr);
fprintf(codefile,
"*%s = enumint;\n"
"}\n",
name);
} else if (t->range == NULL) {
decode_primitive ("heim_integer", name, forwstr);
} else if (t->range->min == INT_MIN && t->range->max == INT_MAX) {