1) Remove the variable initalization in declaration.

2) Change all gBS->FreePool to use the MdePkg/BaseLib's FreePool.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6662 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-11-21 06:59:58 +00:00
parent e38fc27384
commit f4113e1fdb
9 changed files with 105 additions and 103 deletions

View File

@ -301,7 +301,7 @@ ReallocatePool (
CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
}
gBS->FreePool (OldPool);
FreePool (OldPool);
}
return NewPool;
@ -779,7 +779,7 @@ HiiConfigRoutingExportConfig (
AccessResults = NULL;
}
}
gBS->FreePool (ConfigAccessHandles);
FreePool (ConfigAccessHandles);
return EFI_SUCCESS;
}

View File

@ -79,7 +79,7 @@ GrowStack (
//
// Free The Old Stack
//
gBS->FreePool (*Stack);
FreePool (*Stack);
}
//
@ -650,7 +650,7 @@ IfrToUint (
// BUGBUG: Need handle decimal string
//
}
gBS->FreePool (String);
FreePool (String);
} else {
CopyMem (Result, &Value, sizeof (EFI_HII_VALUE));
}
@ -949,7 +949,7 @@ IfrMid (
Result->Type = EFI_IFR_TYPE_STRING;
Result->Value.string = NewString (SubString, FormSet->HiiHandle);
gBS->FreePool (String);
FreePool (String);
return Status;
}
@ -1271,14 +1271,14 @@ CompareHiiValue (
Str2 = GetToken (Value2->Value.string, HiiHandle);
if (Str2 == NULL) {
gBS->FreePool (Str1);
FreePool (Str1);
return EFI_INVALID_PARAMETER;
}
Result = StrCmp (Str1, Str2);
gBS->FreePool (Str1);
gBS->FreePool (Str2);
FreePool (Str1);
FreePool (Str2);
return Result;
}
@ -1525,7 +1525,7 @@ EvaluateExpression (
Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
Value->Value.u64 = StrLen (StrPtr);
gBS->FreePool (StrPtr);
FreePool (StrPtr);
break;
case EFI_IFR_NOT_OP:
@ -1589,7 +1589,7 @@ EvaluateExpression (
} else {
Index = (UINT16) Value->Value.u64;
Value->Value.string = Index;
gBS->FreePool (StrPtr);
FreePool (StrPtr);
}
break;
@ -1629,7 +1629,7 @@ EvaluateExpression (
} else {
Value->Value.b = FALSE;
}
gBS->FreePool (StrPtr);
FreePool (StrPtr);
Value->Type = EFI_IFR_TYPE_BOOLEAN;
}
break;
@ -1669,7 +1669,7 @@ EvaluateExpression (
mUnicodeCollation->StrUpr (mUnicodeCollation, StrPtr);
}
Value->Value.string = NewString (StrPtr, FormSet->HiiHandle);
gBS->FreePool (StrPtr);
FreePool (StrPtr);
break;
case EFI_IFR_BITWISE_NOT_OP:

View File

@ -435,7 +435,7 @@ InitializeRequestElement (
NewStr = AllocateZeroPool (StringSize + CONFIG_REQUEST_STRING_INCREMENTAL * sizeof (CHAR16));
if (Storage->ConfigRequest != NULL) {
CopyMem (NewStr, Storage->ConfigRequest, StringSize);
gBS->FreePool (Storage->ConfigRequest);
FreePool (Storage->ConfigRequest);
}
Storage->ConfigRequest = NewStr;
Storage->SpareStrLen = CONFIG_REQUEST_STRING_INCREMENTAL;
@ -476,7 +476,7 @@ DestroyExpression (
//
// Free this Expression
//
gBS->FreePool (Expression);
FreePool (Expression);
}
@ -560,7 +560,7 @@ DestroyStatement (
Default = QUESTION_DEFAULT_FROM_LINK (Link);
RemoveEntryList (&Default->Link);
gBS->FreePool (Default);
FreePool (Default);
}
//
@ -571,7 +571,7 @@ DestroyStatement (
Option = QUESTION_OPTION_FROM_LINK (Link);
RemoveEntryList (&Option->Link);
gBS->FreePool (Option);
FreePool (Option);
}
//
@ -645,7 +645,7 @@ DestroyForm (
//
// Free this Form
//
gBS->FreePool (Form);
FreePool (Form);
}
@ -692,7 +692,7 @@ DestroyFormSet (
DefaultStore = FORMSET_DEFAULTSTORE_FROM_LINK (Link);
RemoveEntryList (&DefaultStore->Link);
gBS->FreePool (DefaultStore);
FreePool (DefaultStore);
}
}

View File

@ -114,8 +114,8 @@ ReadString (
break;
case SCAN_ESC:
gBS->FreePool (TempString);
gBS->FreePool (BufferedString);
FreePool (TempString);
FreePool (BufferedString);
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
return EFI_DEVICE_ERROR;
@ -129,8 +129,8 @@ ReadString (
case CHAR_CARRIAGE_RETURN:
if (GetStringWidth (StringPtr) >= ((Minimum + 1) * sizeof (CHAR16))) {
gBS->FreePool (TempString);
gBS->FreePool (BufferedString);
FreePool (TempString);
FreePool (BufferedString);
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
return EFI_SUCCESS;
@ -143,8 +143,8 @@ ReadString (
CreateDialog (4, TRUE, 0, NULL, &Key, &NullCharacter, gMiniString, gPressEnter, &NullCharacter);
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
gBS->FreePool (TempString);
gBS->FreePool (BufferedString);
FreePool (TempString);
FreePool (BufferedString);
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
gST->ConOut->EnableCursor (gST->ConOut, CursorVisible);
return EFI_DEVICE_ERROR;
@ -804,7 +804,7 @@ GetSelectionInputPopUp (
if (StrLen (StringPtr) > PopUpWidth) {
PopUpWidth = StrLen (StringPtr);
}
gBS->FreePool (StringPtr);
FreePool (StringPtr);
if (!OrderedList && CompareHiiValue (&Question->HiiValue, &OneOfOption->Value, NULL) == 0) {
//
@ -901,7 +901,7 @@ GetSelectionInputPopUp (
TempStringPtr = AllocateZeroPool (sizeof (CHAR16) * (PopUpWidth - 1));
ASSERT ( TempStringPtr != NULL );
CopyMem (TempStringPtr, StringPtr, (sizeof (CHAR16) * (PopUpWidth - 5)));
gBS->FreePool (StringPtr);
FreePool (StringPtr);
StringPtr = TempStringPtr;
StrCat (StringPtr, L"...");
}
@ -921,7 +921,7 @@ GetSelectionInputPopUp (
}
Index2++;
gBS->FreePool (StringPtr);
FreePool (StringPtr);
}
Character = BOXDRAW_UP_RIGHT;
@ -1067,7 +1067,7 @@ TheKey:
}
}
gBS->FreePool (HiiValueArray);
FreePool (HiiValueArray);
return EFI_DEVICE_ERROR;
default:
@ -1100,7 +1100,7 @@ TheKey:
}
gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);
gBS->FreePool (HiiValueArray);
FreePool (HiiValueArray);
Status = ValidateQuestion (Selection->FormSet, Selection->Form, Question, EFI_HII_EXPRESSION_INCONSISTENT_IF);
if (EFI_ERROR (Status)) {

View File

@ -66,7 +66,7 @@ ClearLines (
gST->ConOut->SetCursorPosition (gST->ConOut, LeftColumn, TopRow);
gBS->FreePool (Buffer);
FreePool (Buffer);
return ;
}
@ -269,7 +269,7 @@ DisplayPageFrame (
break;
}
gBS->FreePool (StrFrontPageBanner);
FreePool (StrFrontPageBanner);
}
}
}
@ -350,7 +350,7 @@ DisplayPageFrame (
}
}
gBS->FreePool (Buffer);
FreePool (Buffer);
}
@ -486,7 +486,7 @@ DisplayForm (
//
// Remove Buffer allocated for StringPtr after it has been used.
//
gBS->FreePool (StringPtr);
FreePool (StringPtr);
//
// Evaluate all the Expressions in this Form
@ -521,7 +521,7 @@ DisplayForm (
NumberOfLines++;
}
gBS->FreePool (OutputString);
FreePool (OutputString);
}
//

View File

@ -147,8 +147,8 @@ PrintInternal (
Out->OutputString (Out, &BackupBuffer[PreviousIndex]);
Count += StrLen (&BackupBuffer[PreviousIndex]);
gBS->FreePool (Buffer);
gBS->FreePool (BackupBuffer);
FreePool (Buffer);
FreePool (BackupBuffer);
return Count;
}

View File

@ -383,7 +383,7 @@ ProcessOptions (
Status = SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
gBS->FreePool (*OptionString);
FreePool (*OptionString);
*OptionString = NULL;
return EFI_NOT_FOUND;
}
@ -407,7 +407,7 @@ ProcessOptions (
Character[0] = CHAR_CARRIAGE_RETURN;
NewStrCat (OptionString[0], Character);
gBS->FreePool (StringPtr);
FreePool (StringPtr);
}
}
}
@ -450,7 +450,7 @@ ProcessOptions (
Link = GetNextNode (&Question->OptionListHead, Link);
}
gBS->FreePool (*OptionString);
FreePool (*OptionString);
*OptionString = NULL;
}
@ -495,7 +495,7 @@ ProcessOptions (
Character[0] = RIGHT_ONEOF_DELIMITER;
NewStrCat (OptionString[0], Character);
gBS->FreePool (StringPtr);
FreePool (StringPtr);
}
}
break;
@ -521,7 +521,7 @@ ProcessOptions (
// Inconsistent check fail, restore Question Value
//
QuestionValue->Value.b = (BOOLEAN) (QuestionValue->Value.b ? FALSE : TRUE);
gBS->FreePool (*OptionString);
FreePool (*OptionString);
*OptionString = NULL;
return Status;
}
@ -641,7 +641,7 @@ ProcessOptions (
UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
}
gBS->FreePool (StringPtr);
FreePool (StringPtr);
} else {
*OptionString = AllocateZeroPool (BufferSize);
ASSERT (*OptionString);
@ -675,7 +675,7 @@ ProcessOptions (
//
// Callback request to terminate password input
//
gBS->FreePool (StringPtr);
FreePool (StringPtr);
return EFI_SUCCESS;
}
@ -685,7 +685,7 @@ ProcessOptions (
//
Status = ReadString (MenuOption, gPromptForPassword, StringPtr);
if (EFI_ERROR (Status)) {
gBS->FreePool (StringPtr);
FreePool (StringPtr);
return Status;
}
@ -703,7 +703,7 @@ ProcessOptions (
Status = EFI_SUCCESS;
}
gBS->FreePool (StringPtr);
FreePool (StringPtr);
return Status;
}
}
@ -717,7 +717,7 @@ ProcessOptions (
//
Status = ReadString (MenuOption, gPromptForPassword, StringPtr);
if (EFI_ERROR (Status)) {
gBS->FreePool (StringPtr);
FreePool (StringPtr);
return Status;
}
@ -730,12 +730,12 @@ ProcessOptions (
//
PasswordInvalid ();
gBS->FreePool (StringPtr);
gBS->FreePool (TempString);
FreePool (StringPtr);
FreePool (TempString);
return Status;
}
gBS->FreePool (TempString);
FreePool (TempString);
}
}
@ -752,7 +752,7 @@ ProcessOptions (
PasswordCallback (Selection, MenuOption, NULL);
}
gBS->FreePool (StringPtr);
FreePool (StringPtr);
return Status;
}
@ -770,8 +770,8 @@ ProcessOptions (
PasswordCallback (Selection, MenuOption, NULL);
}
gBS->FreePool (StringPtr);
gBS->FreePool (TempString);
FreePool (StringPtr);
FreePool (TempString);
return Status;
}
@ -804,8 +804,8 @@ ProcessOptions (
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
}
gBS->FreePool (TempString);
gBS->FreePool (StringPtr);
FreePool (TempString);
FreePool (StringPtr);
}
break;
@ -833,7 +833,7 @@ ProcessHelpString (
IN UINTN RowCount
)
{
UINTN BlockWidth = (UINTN) gHelpBlockWidth - 1;
UINTN BlockWidth;
UINTN AllocateSize;
//
// [PrevCurrIndex, CurrIndex) forms a range of a screen-line
@ -866,6 +866,8 @@ ProcessHelpString (
UINTN *IndexArray;
UINTN *OldIndexArray;
BlockWidth = (UINTN) gHelpBlockWidth - 1;
//
// every three elements of IndexArray form a screen-line of string:[ IndexArray[i*3], IndexArray[i*3+1] )
// IndexArray[i*3+2] stores the initial glyph width of single character. to save this is because we want
@ -877,7 +879,7 @@ ProcessHelpString (
IndexArray = AllocatePool (AllocateSize * sizeof (UINTN) * 3);
if (*FormattedString != NULL) {
gBS->FreePool (*FormattedString);
FreePool (*FormattedString);
*FormattedString = NULL;
}
@ -891,7 +893,7 @@ ProcessHelpString (
OldIndexArray = IndexArray;
IndexArray = AllocatePool (AllocateSize * sizeof (UINTN) * 3);
CopyMem (IndexArray, OldIndexArray, LineCount * sizeof (UINTN) * 3);
gBS->FreePool (OldIndexArray);
FreePool (OldIndexArray);
}
switch (StringPtr[CurrIndex]) {
@ -1020,5 +1022,5 @@ ProcessHelpString (
);
}
gBS->FreePool (IndexArray);
FreePool (IndexArray);
}

View File

@ -333,7 +333,7 @@ SendForm (
} while (Selection->Action == UI_ACTION_REFRESH_FORMSET);
gBS->FreePool (Selection);
FreePool (Selection);
}
if (ActionRequest != NULL) {
@ -482,14 +482,14 @@ BrowserCallback (
if (*ResultsDataSize < BufferSize) {
*ResultsDataSize = BufferSize;
gBS->FreePool (ConfigResp);
FreePool (ConfigResp);
return EFI_BUFFER_TOO_SMALL;
}
*ResultsDataSize = BufferSize;
CopyMem (ResultsData, StrPtr, BufferSize);
gBS->FreePool (ConfigResp);
FreePool (ConfigResp);
} else {
//
// Prepare <ConfigResp>
@ -701,7 +701,7 @@ GetToken (
Status = HiiLibGetString (HiiHandle, Token, String, &BufferLength);
if (Status == EFI_BUFFER_TOO_SMALL) {
gBS->FreePool (String);
FreePool (String);
String = AllocateZeroPool (BufferLength);
ASSERT (String != NULL);
@ -762,7 +762,7 @@ NewStringCat (
StrCpy (NewString, *Dest);
StrCat (NewString, Src);
gBS->FreePool (*Dest);
FreePool (*Dest);
*Dest = NewString;
}
@ -1188,7 +1188,7 @@ GetQuestionValue (
Status = HexStringToBuf (Dst, &StorageWidth, Value, NULL);
}
gBS->FreePool (Value);
FreePool (Value);
}
} else {
//
@ -1241,7 +1241,7 @@ GetQuestionValue (
Value = Value + 6;
}
if (*Value != '=') {
gBS->FreePool (Result);
FreePool (Result);
return EFI_NOT_FOUND;
}
//
@ -1267,7 +1267,7 @@ GetQuestionValue (
} else {
Status = HexStringToBuf (Dst, &StorageWidth, Value, NULL);
if (EFI_ERROR (Status)) {
gBS->FreePool (Result);
FreePool (Result);
return Status;
}
}
@ -1280,7 +1280,7 @@ GetQuestionValue (
} else {
SetValueByName (Storage, Question->VariableName, Value);
}
gBS->FreePool (Result);
FreePool (Result);
}
return Status;
@ -1450,7 +1450,7 @@ SetQuestionValue (
}
Status = SetValueByName (Storage, Question->VariableName, Value);
gBS->FreePool (Value);
FreePool (Value);
}
if (!Cached) {
@ -1505,11 +1505,11 @@ SetQuestionValue (
&Progress
);
if (EFI_ERROR (Status)) {
gBS->FreePool (ConfigResp);
FreePool (ConfigResp);
return Status;
}
}
gBS->FreePool (ConfigResp);
FreePool (ConfigResp);
//
// Synchronize shadow Buffer
@ -1577,7 +1577,7 @@ ValidateQuestion (
do {
CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, PopUp, gPressEnter, gEmptyString);
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
gBS->FreePool (PopUp);
FreePool (PopUp);
}
return EFI_NOT_READY;
@ -1692,11 +1692,11 @@ SubmitForm (
&Progress
);
if (EFI_ERROR (Status)) {
gBS->FreePool (ConfigResp);
FreePool (ConfigResp);
return Status;
}
}
gBS->FreePool (ConfigResp);
FreePool (ConfigResp);
//
// Config success, update storage shadow Buffer
@ -2034,7 +2034,7 @@ LoadStorage (
}
Status = ConfigRespToStorage (Storage, Result);
gBS->FreePool (Result);
FreePool (Result);
return Status;
}
@ -2211,7 +2211,7 @@ GetIfrBinaryData (
//
// Form package not found in this Package List
//
gBS->FreePool (HiiPackageList);
FreePool (HiiPackageList);
return EFI_NOT_FOUND;
}
@ -2230,7 +2230,7 @@ GetIfrBinaryData (
*BinaryLength = PackageHeader.Length - Offset2;
*BinaryData = AllocateCopyPool (*BinaryLength, OpCodeData);
gBS->FreePool (HiiPackageList);
FreePool (HiiPackageList);
if (*BinaryData == NULL) {
return EFI_OUT_OF_RESOURCES;

View File

@ -190,7 +190,7 @@ UiRemoveMenuListEntry (
Selection->FormId = UiMenuList->FormId;
Selection->QuestionId = UiMenuList->QuestionId;
RemoveEntryList (&UiMenuList->MenuLink);
gBS->FreePool (UiMenuList);
FreePool (UiMenuList);
}
}
@ -209,7 +209,7 @@ UiFreeMenuList (
while (!IsListEmpty (&gMenuList)) {
UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE);
RemoveEntryList (&UiMenuList->MenuLink);
gBS->FreePool (UiMenuList);
FreePool (UiMenuList);
}
}
@ -262,9 +262,9 @@ UiFreeMenu (
// Data format : [01/02/2004] [11:22:33]
// Line number : 0 0 1 0 0 1
//
gBS->FreePool (MenuOption->Description);
FreePool (MenuOption->Description);
}
gBS->FreePool (MenuOption);
FreePool (MenuOption);
}
}
@ -282,7 +282,7 @@ UiFreeRefreshList (
while (gMenuRefreshHead != NULL) {
OldMenuRefreshEntry = gMenuRefreshHead->Next;
gBS->FreePool (gMenuRefreshHead);
FreePool (gMenuRefreshHead);
gMenuRefreshHead = OldMenuRefreshEntry;
}
@ -341,7 +341,7 @@ RefreshForm (
;
PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, &OptionString[Index]);
gBS->FreePool (OptionString);
FreePool (OptionString);
}
//
@ -728,8 +728,8 @@ CreateDialog (
case CHAR_NULL:
switch (Key.ScanCode) {
case SCAN_ESC:
gBS->FreePool (TempString);
gBS->FreePool (BufferedString);
FreePool (TempString);
FreePool (BufferedString);
gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
return EFI_DEVICE_ERROR;
@ -742,8 +742,8 @@ CreateDialog (
case CHAR_CARRIAGE_RETURN:
SelectionComplete = TRUE;
gBS->FreePool (TempString);
gBS->FreePool (BufferedString);
FreePool (TempString);
FreePool (BufferedString);
gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);
gST->ConOut->EnableCursor (gST->ConOut, TRUE);
return EFI_SUCCESS;
@ -1017,8 +1017,8 @@ UpdateStatusBar (
break;
}
gBS->FreePool (InputErrorMessage);
gBS->FreePool (NvUpdateMessage);
FreePool (InputErrorMessage);
FreePool (NvUpdateMessage);
return ;
}
@ -1050,7 +1050,7 @@ GetWidth (
if ((Statement->Operand == EFI_IFR_TEXT_OP) && (Statement->TextTwo != 0)) {
String = GetToken (Statement->TextTwo, Handle);
Size = StrLen (String);
gBS->FreePool (String);
FreePool (String);
}
if ((Statement->Operand == EFI_IFR_SUBTITLE_OP) ||
@ -1234,7 +1234,7 @@ UpdateOptionSkipLines (
}
}
gBS->FreePool (OutputString);
FreePool (OutputString);
if (SkipValue != 0) {
SkipValue--;
}
@ -1641,7 +1641,7 @@ UiDisplayMenu (
}
}
gBS->FreePool (OutputString);
FreePool (OutputString);
if (Temp != 0) {
Temp--;
}
@ -1746,7 +1746,7 @@ UiDisplayMenu (
}
}
gBS->FreePool (OutputString);
FreePool (OutputString);
if (Temp2 != 0) {
Temp2--;
}
@ -1755,7 +1755,7 @@ UiDisplayMenu (
Temp2 = 0;
Row = OriginalRow;
gBS->FreePool (OptionString);
FreePool (OptionString);
}
//
// If this is a text op with secondary text information
@ -1789,14 +1789,14 @@ UiDisplayMenu (
}
}
gBS->FreePool (OutputString);
FreePool (OutputString);
if (Temp2 != 0) {
Temp2--;
}
}
Row = OriginalRow;
gBS->FreePool (StringPtr);
FreePool (StringPtr);
}
//
@ -1951,12 +1951,12 @@ UiDisplayMenu (
MenuOption->Row++;
}
gBS->FreePool (OutputString);
FreePool (OutputString);
}
MenuOption->Row = OriginalRow;
gBS->FreePool (OptionString);
FreePool (OptionString);
} else {
if (NewLine) {
if (MenuOption->GrayOut) {
@ -1979,7 +1979,7 @@ UiDisplayMenu (
MenuOption->Row++;
}
gBS->FreePool (OutputString);
FreePool (OutputString);
}
MenuOption->Row = OriginalRow;
@ -2057,12 +2057,12 @@ UiDisplayMenu (
MenuOption->Row++;
}
gBS->FreePool (OutputString);
FreePool (OutputString);
}
MenuOption->Row = OriginalRow;
gBS->FreePool (OptionString);
FreePool (OptionString);
} else {
if (NewLine) {
OriginalRow = MenuOption->Row;
@ -2080,7 +2080,7 @@ UiDisplayMenu (
MenuOption->Row++;
}
gBS->FreePool (OutputString);
FreePool (OutputString);
}
MenuOption->Row = OriginalRow;
@ -2372,8 +2372,8 @@ UiDisplayMenu (
break;
}
gBS->FreePool (StringPtr);
gBS->FreePool (DevicePath);
FreePool (StringPtr);
FreePool (DevicePath);
CopyMem (&Selection->FormSetGuid, &Statement->RefFormSetId, sizeof (EFI_GUID));
Selection->FormId = Statement->RefFormId;