summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellLib/UefiShellLib.c
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-13 23:37:50 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-13 23:37:50 +0000
commit89e8537acfb80a85b06c58ed783fc709df289856 (patch)
treecfcdd0bc5bb3f701034a42766dcd726a571eb6d1 /ShellPkg/Library/UefiShellLib/UefiShellLib.c
parenteef1ed4638011dc2d15f3f613c3e720c382fd294 (diff)
downloadedk2-platforms-89e8537acfb80a85b06c58ed783fc709df289856.tar.xz
change file global variable to function local.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11539 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellLib/UefiShellLib.c')
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index ba0395dec2..d4a80e403c 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -34,8 +34,6 @@ EFI_SHELL_PROTOCOL *mEfiShellProtocol;
EFI_SHELL_PARAMETERS_PROTOCOL *mEfiShellParametersProtocol;
EFI_HANDLE mEfiShellEnvironment2Handle;
FILE_HANDLE_FUNCTION_MAP FileFunctionMap;
-CHAR16 *mPostReplaceFormat;
-CHAR16 *mPostReplaceFormat2;
/**
Check if a Unicode character is a hexadecimal character.
@@ -177,10 +175,6 @@ ShellLibConstructorWorker (
)
{
EFI_STATUS Status;
- mPostReplaceFormat = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
- ASSERT (mPostReplaceFormat != NULL);
- mPostReplaceFormat2 = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
- ASSERT (mPostReplaceFormat2 != NULL);
//
// UEFI 2.0 shell interfaces (used preferentially)
@@ -295,8 +289,6 @@ ShellLibConstructor (
mEfiShellParametersProtocol = NULL;
mEfiShellInterface = NULL;
mEfiShellEnvironment2Handle = NULL;
- mPostReplaceFormat = NULL;
- mPostReplaceFormat2 = NULL;
//
// verify that auto initialize is not set false
@@ -354,15 +346,6 @@ ShellLibDestructor (
}
mEfiShellEnvironment2Handle = NULL;
- if (mPostReplaceFormat != NULL) {
- FreePool(mPostReplaceFormat);
- }
- if (mPostReplaceFormat2 != NULL) {
- FreePool(mPostReplaceFormat2);
- }
- mPostReplaceFormat = NULL;
- mPostReplaceFormat2 = NULL;
-
return (EFI_SUCCESS);
}
@@ -1655,6 +1638,9 @@ ShellFindFilePath (
if (TestPath[StrLen(TestPath)-1] != L'\\') {
StrCat(TestPath, L"\\");
}
+ if (FileName[0] == L'\\') {
+ FileName++;
+ }
StrCat(TestPath, FileName);
if (StrStr(Walker, L";") != NULL) {
Walker = StrStr(Walker, L";") + 1;
@@ -2614,6 +2600,11 @@ InternalShellPrintWorker(
CHAR16 *ResumeLocation;
CHAR16 *FormatWalker;
UINTN OriginalAttribute;
+ CHAR16 *mPostReplaceFormat;
+ CHAR16 *mPostReplaceFormat2;
+
+ mPostReplaceFormat = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
+ mPostReplaceFormat2 = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));
Status = EFI_SUCCESS;
OriginalAttribute = gST->ConOut->Mode->Attribute;
@@ -2705,6 +2696,9 @@ InternalShellPrintWorker(
}
gST->ConOut->SetAttribute(gST->ConOut, OriginalAttribute);
+
+ SHELL_FREE_NON_NULL(mPostReplaceFormat);
+ SHELL_FREE_NON_NULL(mPostReplaceFormat2);
return (Status);
}