]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Refine code to remove the last entry of mArchProtocol.
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 17 Sep 2008 13:31:43 +0000 (13:31 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 17 Sep 2008 13:31:43 +0000 (13:31 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5917 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c

index 2043384f82ea93a8e8179ad5c9ac17d34a422ff2..6eacd233c18c80ccc057b350c377f8a2edae15f8 100644 (file)
@@ -39,8 +39,7 @@ ARCHITECTURAL_PROTOCOL_ENTRY  mArchProtocols[] = {
   { &gEfiCapsuleArchProtocolGuid,          (VOID **)NULL,            NULL, NULL, FALSE },\r
   { &gEfiMonotonicCounterArchProtocolGuid, (VOID **)NULL,            NULL, NULL, FALSE },\r
   { &gEfiResetArchProtocolGuid,            (VOID **)NULL,            NULL, NULL, FALSE },\r
-  { &gEfiRealTimeClockArchProtocolGuid,    (VOID **)NULL,            NULL, NULL, FALSE },\r
-  { NULL,                                  (VOID **)NULL,            NULL, NULL, FALSE }\r
+  { &gEfiRealTimeClockArchProtocolGuid,    (VOID **)NULL,            NULL, NULL, FALSE }\r
 };\r
 \r
 \r
@@ -57,10 +56,10 @@ CoreAllEfiServicesAvailable (
   VOID\r
   )\r
 {\r
-  ARCHITECTURAL_PROTOCOL_ENTRY  *Entry;\r
+  UINTN        Index;\r
 \r
-  for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
-    if (!Entry->Present) {\r
+  for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {\r
+    if (!mArchProtocols[Index].Present) {\r
       return EFI_NOT_FOUND;\r
     }\r
   }\r
@@ -93,9 +92,11 @@ GenericArchProtocolNotify (
   BOOLEAN                         Found;\r
   LIST_ENTRY                      *Link;\r
   LIST_ENTRY                      TempLinkNode;\r
+  UINTN                           Index;\r
 \r
   Found = FALSE;\r
-  for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
+  for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {\r
+    Entry = &mArchProtocols[Index];\r
 \r
     Status = CoreLocateProtocol (Entry->ProtocolGuid, Entry->Registration, &Protocol);\r
     if (EFI_ERROR (Status)) {\r
@@ -180,8 +181,10 @@ CoreNotifyOnArchProtocolInstallation (
 {\r
   EFI_STATUS                      Status;\r
   ARCHITECTURAL_PROTOCOL_ENTRY    *Entry;\r
+  UINTN                           Index;\r
 \r
-  for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
+  for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {\r
+    Entry = &mArchProtocols[Index];\r
 \r
     //\r
     // Create the event\r
@@ -245,8 +248,10 @@ CoreDisplayMissingArchProtocols (
 {\r
   CONST GUID_TO_STRING_PROTOCOL_ENTRY  *MissingEntry;\r
   ARCHITECTURAL_PROTOCOL_ENTRY         *Entry;\r
+  UINTN                                Index;\r
 \r
-  for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) {\r
+  for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) {\r
+    Entry = &mArchProtocols[Index];\r
     if (!Entry->Present) {\r
       for (MissingEntry = MissingProtocols; TRUE ; MissingEntry++) {\r
         if (CompareGuid (Entry->ProtocolGuid, MissingEntry->ProtocolGuid)) {\r