FreeBSD/sys/contrib/dev/acpica/compiler/dtutils.c
/******************************************************************************
 *
 * FUNCTION:    DtSetTableLength
 *
 * PARAMETERS:  None
 *
 * RETURN:      None
 *
 * DESCRIPTION: Walk the subtables and set all the length fields
 *
 *****************************************************************************/


None

Walk the subtables and set all the length fields
None Walk the subtables and set all the length fields
void
DtSetTableLength (
    void)
{
    DT_SUBTABLE             *ParentTable;
    DT_SUBTABLE             *ChildTable;
    ParentTable = Gbl_RootTable;
    ChildTable = NULL;
    if (!ParentTable)
    {
        return;
    }
    DtSetSubtableLength (ParentTable);
    while (1)
    {
        ChildTable = DtGetNextSubtable (ParentTable, ChildTable);
        if (ChildTable)
        {
            if (ChildTable->LengthField)
            {
                DtSetSubtableLength (ChildTable);
            }
            if (ChildTable->Child)
            {
                ParentTable = ChildTable;
                ChildTable = NULL;
            }
            else
            {
                ParentTable->TotalLength += ChildTable->TotalLength;
                if (ParentTable->LengthField)
                {
                    DtSetSubtableLength (ParentTable);
                }
            }
        }
        else
        {
            ChildTable = ParentTable;
            if (ChildTable == Gbl_RootTable)
            {
                break;
            }
            ParentTable = DtGetParentSubtable (ParentTable);
            ParentTable->TotalLength += ChildTable->TotalLength;
            if (ParentTable->LengthField)
            {
                DtSetSubtableLength (ParentTable);
            }
        }
    }
}
void DtSetTableLength ( void ) { DT_SUBTABLE * ParentTable ; DT_SUBTABLE * ChildTable ; ParentTable = Gbl_RootTable ; ChildTable = NULL ; if ( ! ParentTable ) { return ; } DtSetSubtableLength ( ParentTable ) ; while ( 1 ) { ChildTable = DtGetNextSubtable ( ParentTable , ChildTable ) ; if ( ChildTable ) { if ( ChildTable -> LengthField ) { DtSetSubtableLength ( ChildTable ) ; } if ( ChildTable -> Child ) { ParentTable = ChildTable ; ChildTable = NULL ; } else { ParentTable -> TotalLength += ChildTable -> TotalLength ; if ( ParentTable -> LengthField ) { DtSetSubtableLength ( ParentTable ) ; } } } else { ChildTable = ParentTable ; if ( ChildTable == Gbl_RootTable ) { break ; } ParentTable = DtGetParentSubtable ( ParentTable ) ; ParentTable -> TotalLength += ChildTable -> TotalLength ; if ( ParentTable -> LengthField ) { DtSetSubtableLength ( ParentTable ) ; } } } }
FUNCTION:    DtSetTableLength
 PARAMETERS:  None
FUNCTION : DtSetTableLength PARAMETERS : None