Reviewed-by: Erik Bjorge <[email protected]>
> -----Original Message----- > From: edk2-devel [mailto:[email protected]] On Behalf Of > Jaben Carsey > Sent: Thursday, May 12, 2016 3:10 PM > To: [email protected] > Cc: Qiu, Shumin <[email protected]> > Subject: [edk2] [Patch] Use a local variable to cache the pointer. > > CC: Qiu Shumin <[email protected]> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jaben Carsey <[email protected]> > --- > ShellPkg/Application/Shell/Shell.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/ShellPkg/Application/Shell/Shell.c > b/ShellPkg/Application/Shell/Shell.c > index b06c1ef..47b3118 100644 > --- a/ShellPkg/Application/Shell/Shell.c > +++ b/ShellPkg/Application/Shell/Shell.c > @@ -2499,6 +2499,7 @@ SetupAndRunCommandOrFile( > SHELL_FILE_HANDLE OriginalStdOut; > SHELL_FILE_HANDLE OriginalStdErr; > SYSTEM_TABLE_INFO OriginalSystemTableInfo; > + CONST SCRIPT_FILE *ConstScriptFile; > > // > // Update the StdIn, StdOut, and StdErr for redirection to > environment variables, files, etc... unicode and ASCII > @@ -2518,10 +2519,11 @@ SetupAndRunCommandOrFile( > // Now print errors > // > if (EFI_ERROR(Status)) { > - if (ShellCommandGetCurrentScriptFile() == NULL || > ShellCommandGetCurrentScriptFile()->CurrentCommand == NULL) { > + ConstScriptFile = ShellCommandGetCurrentScriptFile(); > + if (ConstScriptFile == NULL || ConstScriptFile->CurrentCommand == > NULL) { > ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SHELL_ERROR), > ShellInfoObject.HiiHandle, (VOID*)(Status)); > } else { > - ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN > (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID*)(Status), > ShellCommandGetCurrentScriptFile()->CurrentCommand->Line); > + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN > (STR_SHELL_ERROR_SCRIPT), ShellInfoObject.HiiHandle, (VOID*)(Status), > ConstScriptFile->CurrentCommand->Line); > } > } > > -- > 2.7.2.windows.1 > > _______________________________________________ > edk2-devel mailing list > [email protected] > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

