From 2c3b5ec562c7b43a73424e1be25e2053d1edfe4f Mon Sep 17 00:00:00 2001 From: lgao4 Date: Wed, 14 Mar 2007 02:02:43 +0000 Subject: 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 --- .../Console/GraphicsConsole/Dxe/GraphicsConsole.c | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'EdkModulePkg/Universal/Console/GraphicsConsole') 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 -- cgit v1.2.3