/*---------------------------------------------------------------------*/ /* getAllocSize - returns size of a type chain in bytes for allocation */ /*---------------------------------------------------------------------*/ unsigned int getAllocSize (sym_link *p) { if (IS_STRUCT (p) && SPEC_STRUCT (p)->type == STRUCT) { /* if this is a struct specifier then */ /* calculate the size as it could end */ /* with an array of unspecified length */ unsigned int size = 0; symbol *sflds = SPEC_STRUCT (p)->fields; while (sflds && sflds->next) sflds = sflds->next; if (sflds && !IS_BITFIELD (sflds->type)) size = sflds->offset + getAllocSize (sflds->type); else size = SPEC_STRUCT (p)->size; return size; } else return getSize (p); }