MdeModulePkg/Core/PiSmmCore: rebase to ARRAY_SIZE()

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Feng Tian <feng.tian@Intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
Laszlo Ersek 2016-10-26 18:58:17 +02:00
parent ed998e06a4
commit 8368951f1b
2 changed files with 4 additions and 4 deletions

View File

@ -42,7 +42,7 @@ SmmInitializeMemoryServices (
// //
// Initialize Pool list // Initialize Pool list
// //
for (Index = sizeof (mSmmPoolLists) / sizeof (*mSmmPoolLists); Index > 0;) { for (Index = ARRAY_SIZE (mSmmPoolLists); Index > 0;) {
InitializeListHead (&mSmmPoolLists[--Index]); InitializeListHead (&mSmmPoolLists[--Index]);
} }
CurrentSmramRangesIndex = 0; CurrentSmramRangesIndex = 0;

View File

@ -2670,7 +2670,7 @@ ProfileMemoryTypeToStr (
) )
{ {
UINTN Index; UINTN Index;
for (Index = 0; Index < sizeof (mMemoryTypeString) / sizeof (mMemoryTypeString[0]); Index++) { for (Index = 0; Index < ARRAY_SIZE (mMemoryTypeString); Index++) {
if (mMemoryTypeString[Index].MemoryType == MemoryType) { if (mMemoryTypeString[Index].MemoryType == MemoryType) {
return mMemoryTypeString[Index].MemoryTypeStr; return mMemoryTypeString[Index].MemoryTypeStr;
} }
@ -2697,12 +2697,12 @@ ProfileActionToStr (
CHAR8 **ActionString; CHAR8 **ActionString;
ActionString = mSmmActionString; ActionString = mSmmActionString;
ActionStringCount = sizeof (mSmmActionString) / sizeof (mSmmActionString[0]); ActionStringCount = ARRAY_SIZE (mSmmActionString);
if ((UINTN) (UINT32) Action < ActionStringCount) { if ((UINTN) (UINT32) Action < ActionStringCount) {
return ActionString[Action]; return ActionString[Action];
} }
for (Index = 0; Index < sizeof (mExtActionString) / sizeof (mExtActionString[0]); Index++) { for (Index = 0; Index < ARRAY_SIZE (mExtActionString); Index++) {
if (mExtActionString[Index].Action == Action) { if (mExtActionString[Index].Action == Action) {
return mExtActionString[Index].String; return mExtActionString[Index].String;
} }