diff mbox

[edk2,22/47] MdeModulePkg/Core/PiSmmCore: rebase to ARRAY_SIZE()

Message ID 20161026190504.9888-23-lersek@redhat.com
State Accepted
Commit 8368951f1bc7f7b45ad991340aeeac1f345ff013
Headers show

Commit Message

Laszlo Ersek Oct. 26, 2016, 7:04 p.m. UTC
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>

---
 MdeModulePkg/Core/PiSmmCore/Pool.c               | 2 +-
 MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.9.2


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Kinney, Michael D Oct. 27, 2016, 2:20 a.m. UTC | #1
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>


> -----Original Message-----

> From: Laszlo Ersek [mailto:lersek@redhat.com]

> Sent: Wednesday, October 26, 2016 12:05 PM

> To: edk2-devel-01 <edk2-devel@ml01.01.org>

> Cc: Tian, Feng <feng.tian@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>;

> Zeng, Star <star.zeng@intel.com>

> Subject: [PATCH 22/47] 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>

> ---

>  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 9d447025883d..02dab0142560 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 93585f199df9..d983cefbb3dc 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;

>      }

> --

> 2.9.2

> 


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/MdeModulePkg/Core/PiSmmCore/Pool.c b/MdeModulePkg/Core/PiSmmCore/Pool.c
index 9d447025883d..02dab0142560 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 93585f199df9..d983cefbb3dc 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;
     }