summaryrefslogtreecommitdiff
path: root/MdePkg/Library/DxeExtractGuidedSectionLib
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-08-18 12:11:37 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-08-18 12:11:37 +0000
commitb911d09f5525e5bb27d5c9dffcfd6120e095ac84 (patch)
tree657ff1575c56b81d968d90f29238313fae127816 /MdePkg/Library/DxeExtractGuidedSectionLib
parentd1a44d08c1b221669e88f27801b3e4ae26d7fd96 (diff)
Code Clean up for IfrSupportLib, HiiLib, PeiExtractGuidedSectionLib and DxeExtractGuidedSectionLib,
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5687 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/DxeExtractGuidedSectionLib')
-rw-r--r--MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c74
-rw-r--r--MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf2
2 files changed, 31 insertions, 45 deletions
diff --git a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
index b98e8f3ae..725082874 100644
--- a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
+++ b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
@@ -21,7 +21,7 @@
#include <Library/ExtractGuidedSectionLib.h>
STATIC GUID *mExtractHandlerGuidTable;
-STATIC UINT32 mNumberOfExtractHandler;
+STATIC UINT32 mNumberOfExtractHandler = 0;
STATIC EXTRACT_GUIDED_SECTION_DECODE_HANDLER *mExtractDecodeHandlerTable;
STATIC EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *mExtractGetInfoHandlerTable;
@@ -52,19 +52,17 @@ DxeExtractGuidedSectionLibConstructor (
mExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *) AllocatePool (PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER));
if (mExtractDecodeHandlerTable == NULL) {
+ FreePool (mExtractHandlerGuidTable);
return RETURN_OUT_OF_RESOURCES;
}
mExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) AllocatePool (PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER));
if (mExtractGetInfoHandlerTable == NULL) {
+ FreePool (mExtractHandlerGuidTable);
+ FreePool (mExtractDecodeHandlerTable);
return RETURN_OUT_OF_RESOURCES;
}
- //
- // the initialized number is Zero.
- //
- mNumberOfExtractHandler = 0;
-
return RETURN_SUCCESS;
}
@@ -122,18 +120,14 @@ ExtractGuidedSectionRegisterHandlers (
//
for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {
if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionGuid)) {
- break;
+ //
+ // If the guided handler has been registered before, only update its handler.
+ //
+ mExtractDecodeHandlerTable [Index] = DecodeHandler;
+ mExtractGetInfoHandlerTable [Index] = GetInfoHandler;
+ return RETURN_SUCCESS;
}
}
-
- //
- // If the guided handler has been registered before, only update its handler.
- //
- if (Index < mNumberOfExtractHandler) {
- mExtractDecodeHandlerTable [Index] = DecodeHandler;
- mExtractGetInfoHandlerTable [Index] = GetInfoHandler;
- return RETURN_SUCCESS;
- }
//
// Check the global table is enough to contain new Handler.
@@ -197,26 +191,22 @@ ExtractGuidedSectionGetInfo (
//
for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {
if (CompareGuid (&mExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
- break;
+ //
+ // Call the match handler to getinfo for the input section data.
+ //
+ return mExtractGetInfoHandlerTable [Index] (
+ InputSection,
+ OutputBufferSize,
+ ScratchBufferSize,
+ SectionAttribute
+ );
}
}
//
// Not found, the input guided section is not supported.
//
- if (Index == mNumberOfExtractHandler) {
- return RETURN_UNSUPPORTED;
- }
-
- //
- // Call the match handler to getinfo for the input section data.
- //
- return mExtractGetInfoHandlerTable [Index] (
- InputSection,
- OutputBufferSize,
- ScratchBufferSize,
- SectionAttribute
- );
+ return RETURN_UNSUPPORTED;
}
/**
@@ -270,24 +260,20 @@ ExtractGuidedSectionDecode (
//
for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {
if (CompareGuid (&mExtractHandlerGuidTable[Index], &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
- break;
+ //
+ // Call the match handler to extract raw data for the input section data.
+ //
+ return mExtractDecodeHandlerTable [Index] (
+ InputSection,
+ OutputBuffer,
+ ScratchBuffer,
+ AuthenticationStatus
+ );
}
}
//
// Not found, the input guided section is not supported.
//
- if (Index == mNumberOfExtractHandler) {
- return RETURN_UNSUPPORTED;
- }
-
- //
- // Call the match handler to extract raw data for the input section data.
- //
- return mExtractDecodeHandlerTable [Index] (
- InputSection,
- OutputBuffer,
- ScratchBuffer,
- AuthenticationStatus
- );
+ return RETURN_UNSUPPORTED;
}
diff --git a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
index 7bed5477e..5e288dde8 100644
--- a/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+++ b/MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
@@ -44,7 +44,7 @@
BaseMemoryLib
DebugLib
-[FixedPcd.common]
+[Pcd.common]
gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler