Converter: refactor code to call CvFilenameExists only once.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
This commit is contained in:
Erik Schmauss 2017-02-28 17:10:45 -08:00
parent d2d2fa1ad2
commit 916c024136

View File

@ -496,6 +496,7 @@ CvSwitchFiles(
{
char *Filename = Op->Common.CvFilename;
ACPI_FILE_NODE *FNode;
ACPI_FILE_NODE *Current;
CvDbgPrint ("Switching from %s to %s\n", AcpiGbl_CurrentFilename, Filename);
FNode = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot);
@ -510,23 +511,23 @@ CvSwitchFiles(
AslCommonError (ASL_ERROR, ASL_MSG_OPEN, 0, 0, 0, 0, NULL, MsgBuffer);
AslAbort ();
}
Current = FNode;
/*
* If the previous file is a descendent of the current file,
* make sure that Include statements from the current file
* to the previous have been emitted.
*/
while (FNode &&
FNode->Parent &&
AcpiUtStricmp (FNode->Filename, AcpiGbl_CurrentFilename))
while (Current &&
Current->Parent &&
AcpiUtStricmp (Current->Filename, AcpiGbl_CurrentFilename))
{
CvPrintInclude (FNode, Level);
FNode = FNode->Parent;
Current = Current->Parent;
}
/* Redirect output to the Op->Common.CvFilename */
/* Redirect output to Op->Common.CvFilename */
FNode = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot);
AcpiOsRedirectOutput (FNode->File);
AcpiGbl_CurrentFilename = FNode->Filename;
}