From 8368951f1bc7f7b45ad991340aeeac1f345ff013 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 26 Oct 2016 18:58:17 +0200 Subject: [PATCH] MdeModulePkg/Core/PiSmmCore: rebase to ARRAY_SIZE() Cc: Feng Tian Cc: Michael D Kinney Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Michael Kinney Reviewed-by: Feng Tian Reviewed-by: Star Zeng Reviewed-by: Jordan Justen --- MdeModulePkg/Core/PiSmmCore/Pool.c | 2 +- MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Core/PiSmmCore/Pool.c b/MdeModulePkg/Core/PiSmmCore/Pool.c index 9d44702588..02dab01425 100644 --- a/MdeModulePkg/Core/PiSmmCore/Pool.c +++ b/MdeModulePkg/Core/PiSmmCore/Pool.c @@ -42,7 +42,7 @@ SmmInitializeMemoryServices ( // // Initialize Pool list // - for (Index = sizeof (mSmmPoolLists) / sizeof (*mSmmPoolLists); Index > 0;) { + for (Index = ARRAY_SIZE (mSmmPoolLists); Index > 0;) { InitializeListHead (&mSmmPoolLists[--Index]); } CurrentSmramRangesIndex = 0; diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c index 93585f199d..d983cefbb3 100644 --- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c +++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c @@ -2670,7 +2670,7 @@ ProfileMemoryTypeToStr ( ) { 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) { return mMemoryTypeString[Index].MemoryTypeStr; } @@ -2697,12 +2697,12 @@ ProfileActionToStr ( CHAR8 **ActionString; ActionString = mSmmActionString; - ActionStringCount = sizeof (mSmmActionString) / sizeof (mSmmActionString[0]); + ActionStringCount = ARRAY_SIZE (mSmmActionString); if ((UINTN) (UINT32) Action < ActionStringCount) { 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) { return mExtActionString[Index].String; }