diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-03-14 02:02:43 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-03-14 02:02:43 +0000 |
commit | 2c3b5ec562c7b43a73424e1be25e2053d1edfe4f (patch) | |
tree | 01495edfd3c8cdd9ae39054443a47b198bc48e10 /EdkModulePkg/Universal/Console | |
parent | 9db9711c414fe3207ffae81b3c1627554c428308 (diff) | |
download | edk2-platforms-2c3b5ec562c7b43a73424e1be25e2053d1edfe4f.tar.xz |
Clean up the gBS sevice (CopyMem, SetMem, AllocatePool, FreePool) with the corresponding APIs defined in Mde library class for these modules.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2456 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Universal/Console')
4 files changed, 56 insertions, 62 deletions
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c index 34d6f266e9..7d1a3fea1d 100644 --- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c +++ b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitter.c @@ -1333,7 +1333,7 @@ Returns: CopyMem (Ptr, *Buffer, OldSize);
if (*Buffer != NULL) {
- gBS->FreePool (*Buffer);
+ FreePool (*Buffer);
}
*Buffer = Ptr;
@@ -1573,7 +1573,7 @@ Returns: //
// Free the old buffer
//
- gBS->FreePool (OldTextOutModeMap);
+ FreePool (OldTextOutModeMap);
}
return EFI_SUCCESS;
@@ -1924,8 +1924,8 @@ Returns: mStdErr.TextOut.SetMode (&(mStdErr.TextOut), 0);
}
- gBS->FreePool (ConOutMapTable);
- gBS->FreePool (StdErrMapTable);
+ FreePool (ConOutMapTable);
+ FreePool (StdErrMapTable);
return EFI_SUCCESS;
}
@@ -1986,7 +1986,7 @@ Returns: if (ModeBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- gBS->FreePool (Private->GraphicsOutputModeBuffer);
+ FreePool (Private->GraphicsOutputModeBuffer);
Private->GraphicsOutputModeBuffer = ModeBuffer;
//
@@ -2001,7 +2001,7 @@ Returns: Mode->HorizontalResolution = Info->HorizontalResolution;
Mode->VerticalResolution = Info->VerticalResolution;
Mode++;
- gBS->FreePool (Info);
+ FreePool (Info);
}
} else {
//
@@ -2025,10 +2025,10 @@ Returns: if ((Info->HorizontalResolution == Mode->HorizontalResolution) &&
(Info->VerticalResolution == Mode->VerticalResolution)){
Match = TRUE;
- gBS->FreePool (Info);
+ FreePool (Info);
break;
}
- gBS->FreePool (Info);
+ FreePool (Info);
}
if (Match) {
@@ -2042,7 +2042,7 @@ Returns: //
// Drop the old mode buffer, assign it to a new one
//
- gBS->FreePool (Private->GraphicsOutputModeBuffer);
+ FreePool (Private->GraphicsOutputModeBuffer);
Private->GraphicsOutputModeBuffer = ModeBuffer;
//
@@ -2305,7 +2305,7 @@ Returns: Private->TextOutQueryDataCount * sizeof (TEXT_OUT_SPLITTER_QUERY_DATA)
);
- gBS->FreePool (Private->TextOutModeMap);
+ FreePool (Private->TextOutModeMap);
Private->TextOutModeMap = NULL;
TextOutList = Private->TextOutList;
@@ -3033,7 +3033,7 @@ ConSplitterTextOutOutputString ( }
if (BackSpaceCount) {
- gBS->FreePool (TargetString);
+ FreePool (TargetString);
}
return ReturnStatus;
diff --git a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c index 9726889ec8..9faeb56d12 100644 --- a/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c +++ b/EdkModulePkg/Universal/Console/ConSplitter/Dxe/ConSplitterGraphics.c @@ -192,7 +192,6 @@ ConSpliterGraphicsOutputQueryMode ( --*/
{
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
- EFI_STATUS Status;
TEXT_OUT_GOP_MODE *Mode;
if (This == NULL || Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {
@@ -208,13 +207,10 @@ ConSpliterGraphicsOutputQueryMode ( return EFI_NOT_STARTED;
}
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION),
- (VOID **) Info
- );
- if (EFI_ERROR (Status)) {
- return Status;
+ *Info = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION));
+
+ if (*Info == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
*SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
@@ -282,7 +278,7 @@ Routine Description: // Free the old version
//
if (Private->GraphicsOutputBlt != NULL) {
- gBS->FreePool (Private->GraphicsOutputBlt);
+ FreePool (Private->GraphicsOutputBlt);
}
//
@@ -316,10 +312,10 @@ Routine Description: return Status;
}
if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) {
- gBS->FreePool (Info);
+ FreePool (Info);
break;
}
- gBS->FreePool (Info);
+ FreePool (Info);
}
Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);
@@ -754,7 +750,7 @@ ConSpliterUgaDrawSetMode ( //
// Free the old version
//
- gBS->FreePool (Private->UgaBlt);
+ FreePool (Private->UgaBlt);
//
// Allocate the virtual Blt buffer
@@ -1319,7 +1315,7 @@ DevNullTextOutSetMode ( Private->DevNullColumns = Column;
Private->DevNullRows = Row;
- gBS->FreePool (Private->DevNullScreen);
+ FreePool (Private->DevNullScreen);
Size = (Row * (Column + 1)) * sizeof (CHAR16);
Private->DevNullScreen = AllocateZeroPool (Size);
@@ -1327,7 +1323,7 @@ DevNullTextOutSetMode ( return EFI_OUT_OF_RESOURCES;
}
- gBS->FreePool (Private->DevNullAttributes);
+ FreePool (Private->DevNullAttributes);
Size = Row * Column * sizeof (INT32);
Private->DevNullAttributes = AllocateZeroPool (Size);
@@ -1604,7 +1600,7 @@ DevNullSyncGopStdOut ( }
}
- gBS->FreePool (Buffer);
+ FreePool (Buffer);
return ReturnStatus;
}
diff --git a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c index 3f79991f3c..d3feef8ee4 100644 --- a/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c +++ b/EdkModulePkg/Universal/Console/GraphicsConsole/Dxe/GraphicsConsole.c @@ -320,12 +320,12 @@ GraphicsConsoleControllerDriverStart ( //
Package = PreparePackages (1, NULL, FontPack);
mHii->NewPack (mHii, Package, &(Private->HiiHandle));
- gBS->FreePool (Package);
+ FreePool (Package);
//
// Free the font database
//
- gBS->FreePool (FontPack);
+ FreePool (FontPack);
//
// If the current mode information can not be retrieved, then attemp to set the default mode
@@ -350,11 +350,11 @@ GraphicsConsoleControllerDriverStart ( (Info->VerticalResolution == 600)) {
Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, ModeNumber);
if (!EFI_ERROR (Status)) {
- gBS->FreePool (Info);
+ FreePool (Info);
break;
}
}
- gBS->FreePool (Info);
+ FreePool (Info);
}
}
@@ -507,8 +507,8 @@ Error: // Free private data
//
if (Private != NULL) {
- gBS->FreePool (Private->LineBuffer);
- gBS->FreePool (Private);
+ FreePool (Private->LineBuffer);
+ FreePool (Private);
}
}
@@ -577,8 +577,8 @@ GraphicsConsoleControllerDriverStop ( // Free our instance data
//
if (Private != NULL) {
- gBS->FreePool (Private->LineBuffer);
- gBS->FreePool (Private);
+ FreePool (Private->LineBuffer);
+ FreePool (Private);
}
}
@@ -1166,16 +1166,14 @@ GraphicsConsoleConOutSetMode ( //
// Attempt to allocate a line buffer for the requested mode number
//
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->Columns * GLYPH_WIDTH * GLYPH_HEIGHT,
- (VOID **) &NewLineBuffer
- );
- if (EFI_ERROR (Status)) {
+ NewLineBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->Columns * GLYPH_WIDTH * GLYPH_HEIGHT);
+
+ if (NewLineBuffer == NULL) {
//
// The new line buffer could not be allocated, so return an error.
// No changes to the state of the current console have been made, so the current console is still valid
//
+ Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
//
@@ -1191,7 +1189,7 @@ GraphicsConsoleConOutSetMode ( // If the new mode is the same as the old mode, then just return EFI_SUCCESS
//
if ((INT32) ModeNumber == This->Mode->Mode) {
- gBS->FreePool (NewLineBuffer);
+ FreePool (NewLineBuffer);
Status = EFI_SUCCESS;
goto Done;
}
@@ -1201,7 +1199,7 @@ GraphicsConsoleConOutSetMode ( //
This->EnableCursor (This, FALSE);
- gBS->FreePool (Private->LineBuffer);
+ FreePool (Private->LineBuffer);
}
//
// Assign the current line buffer to the newly allocated line buffer
diff --git a/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c b/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c index 6aa70e4c95..ba113c27ad 100644 --- a/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c +++ b/EdkModulePkg/Universal/Console/Terminal/Dxe/Terminal.c @@ -275,7 +275,7 @@ TerminalDriverBindingStart ( }
}
- gBS->FreePool (OpenInfoBuffer);
+ FreePool (OpenInfoBuffer);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -566,7 +566,7 @@ TerminalDriverBindingStart ( }
if (DefaultNode != NULL) {
- gBS->FreePool (DefaultNode);
+ FreePool (DefaultNode);
}
return EFI_SUCCESS;
@@ -604,15 +604,15 @@ Error: }
if (TerminalDevice->DevicePath != NULL) {
- gBS->FreePool (TerminalDevice->DevicePath);
+ FreePool (TerminalDevice->DevicePath);
}
- gBS->FreePool (TerminalDevice);
+ FreePool (TerminalDevice);
}
}
if (DefaultNode != NULL) {
- gBS->FreePool (DefaultNode);
+ FreePool (DefaultNode);
}
This->Stop (This, Controller, 0, NULL);
@@ -713,7 +713,7 @@ TerminalDriverBindingStop ( // Free the ParentDevicePath that was duplicated in Start()
//
if (!EFI_ERROR (Status)) {
- gBS->FreePool (ParentDevicePath);
+ FreePool (ParentDevicePath);
}
}
@@ -803,8 +803,8 @@ TerminalDriverBindingStop ( gBS->CloseEvent (TerminalDevice->TwoSecondTimeOut);
gBS->CloseEvent (TerminalDevice->SimpleInput.WaitForKey);
- gBS->FreePool (TerminalDevice->DevicePath);
- gBS->FreePool (TerminalDevice);
+ FreePool (TerminalDevice->DevicePath);
+ FreePool (TerminalDevice);
}
}
@@ -850,11 +850,11 @@ TerminalUpdateConsoleDevVariable ( SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath);
NewVariable = AppendDevicePathInstance (Variable, TempDevicePath);
if (Variable != NULL) {
- gBS->FreePool (Variable);
+ FreePool (Variable);
}
if (TempDevicePath != NULL) {
- gBS->FreePool (TempDevicePath);
+ FreePool (TempDevicePath);
}
Variable = NewVariable;
@@ -870,7 +870,7 @@ TerminalUpdateConsoleDevVariable ( Variable
);
ASSERT_EFI_ERROR (Status);
- gBS->FreePool (Variable);
+ FreePool (Variable);
return ;
}
@@ -932,7 +932,7 @@ TerminalRemoveConsoleDevVariable ( //
Instance = GetNextDevicePathInstance (&Variable, &InstanceSize);
if (Instance == NULL) {
- gBS->FreePool (OriginalVariable);
+ FreePool (OriginalVariable);
return ;
}
//
@@ -956,7 +956,7 @@ TerminalRemoveConsoleDevVariable ( FoundOne = TRUE;
}
- gBS->FreePool (TempDevicePath);
+ FreePool (TempDevicePath);
}
}
//
@@ -966,17 +966,17 @@ TerminalRemoveConsoleDevVariable ( SavedNewVariable = NewVariable;
NewVariable = AppendDevicePathInstance (NewVariable, Instance);
if (SavedNewVariable != NULL) {
- gBS->FreePool (SavedNewVariable);
+ FreePool (SavedNewVariable);
}
}
//
// Get next device path instance from Variable
//
- gBS->FreePool (Instance);
+ FreePool (Instance);
Instance = GetNextDevicePathInstance (&Variable, &InstanceSize);
} while (Instance != NULL);
- gBS->FreePool (OriginalVariable);
+ FreePool (OriginalVariable);
if (FoundOne) {
VariableSize = GetDevicePathSize (NewVariable);
@@ -992,7 +992,7 @@ TerminalRemoveConsoleDevVariable ( }
if (NewVariable != NULL) {
- gBS->FreePool (NewVariable);
+ FreePool (NewVariable);
}
return ;
@@ -1051,7 +1051,7 @@ Returns: //
// Allocate the buffer to return
//
- gBS->FreePool (Buffer);
+ FreePool (Buffer);
Buffer = AllocatePool (BufferSize);
if (Buffer == NULL) {
*VariableSize = 0;
@@ -1063,7 +1063,7 @@ Returns: Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
if (EFI_ERROR (Status)) {
BufferSize = 0;
- gBS->FreePool (Buffer);
+ FreePool (Buffer);
Buffer = NULL;
}
} else {
@@ -1071,7 +1071,7 @@ Returns: // Variable not found or other errors met.
//
BufferSize = 0;
- gBS->FreePool (Buffer);
+ FreePool (Buffer);
Buffer = NULL;
}
|