From f012e3a442e6f19a3c66ebcdd60944e738f238f0 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Tue, 24 Apr 2012 18:55:33 +0200 Subject: [PATCH] Reduce code duplication in layout_struct_type(). --- type.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/type.c b/type.c index 58c4a34..6a121d8 100644 --- a/type.c +++ b/type.c @@ -1511,16 +1511,12 @@ void layout_struct_type(compound_type_t *type) entity_t *entry = compound->members.entities; while (entry != NULL) { - if (entry->kind != ENTITY_COMPOUND_MEMBER) { - entry = entry->base.next; - continue; - } + if (entry->kind != ENTITY_COMPOUND_MEMBER) + goto next; - type_t *const m_type = skip_typeref(entry->declaration.type); - if (!is_type_valid(m_type)) { - entry = entry->base.next; - continue; - } + type_t *const m_type = skip_typeref(entry->declaration.type); + if (!is_type_valid(m_type)) + goto next; if (entry->compound_member.bitfield) { entry = pack_bitfield_members(&offset, &alignment, @@ -1544,6 +1540,7 @@ void layout_struct_type(compound_type_t *type) entry->compound_member.offset = offset; offset += get_type_size(m_type); +next: entry = entry->base.next; } -- 2.20.1