Fix #14804 - Make sure anon structs have unique names (#14806)

* Also skip "union" to get type
This commit is contained in:
GustavoLCR 2019-08-15 01:00:20 -03:00 committed by Anton Kochkov
parent e915bfa2db
commit 87079ea21c
2 changed files with 3 additions and 1 deletions

View File

@ -124,6 +124,8 @@ R_API int r_type_get_bitsize(Sdb *TDB, const char *type) {
const char *tmptype;
if (!strncmp (type, "struct ", 7)) {
tmptype = type + 7;
} else if (!strncmp (type, "union ", 6)) {
tmptype = type + 6;
} else {
tmptype = type;
}

View File

@ -983,7 +983,7 @@ static void struct_decl(CType *type, int u) {
goto do_decl;
}
} else {
static char buf[STRING_MAX_SIZE + 1];
char buf[STRING_MAX_SIZE + 1];
v = anon_sym++;
snprintf (buf, sizeof(buf), "%u", v - SYM_FIRST_ANOM);
name = buf;