From: qhuang8 Date: Wed, 17 Sep 2008 13:31:43 +0000 (+0000) Subject: Refine code to remove the last entry of mArchProtocol. X-Git-Tag: edk2-stable201903~20306 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=3f1435782f57f001a7f4ae7d928d817ee3fe27f0 Refine code to remove the last entry of mArchProtocol. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5917 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c index 2043384f82..6eacd233c1 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c @@ -39,8 +39,7 @@ ARCHITECTURAL_PROTOCOL_ENTRY mArchProtocols[] = { { &gEfiCapsuleArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE }, { &gEfiMonotonicCounterArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE }, { &gEfiResetArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE }, - { &gEfiRealTimeClockArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE }, - { NULL, (VOID **)NULL, NULL, NULL, FALSE } + { &gEfiRealTimeClockArchProtocolGuid, (VOID **)NULL, NULL, NULL, FALSE } }; @@ -57,10 +56,10 @@ CoreAllEfiServicesAvailable ( VOID ) { - ARCHITECTURAL_PROTOCOL_ENTRY *Entry; + UINTN Index; - for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) { - if (!Entry->Present) { + for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) { + if (!mArchProtocols[Index].Present) { return EFI_NOT_FOUND; } } @@ -93,9 +92,11 @@ GenericArchProtocolNotify ( BOOLEAN Found; LIST_ENTRY *Link; LIST_ENTRY TempLinkNode; + UINTN Index; Found = FALSE; - for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) { + for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) { + Entry = &mArchProtocols[Index]; Status = CoreLocateProtocol (Entry->ProtocolGuid, Entry->Registration, &Protocol); if (EFI_ERROR (Status)) { @@ -180,8 +181,10 @@ CoreNotifyOnArchProtocolInstallation ( { EFI_STATUS Status; ARCHITECTURAL_PROTOCOL_ENTRY *Entry; + UINTN Index; - for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) { + for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) { + Entry = &mArchProtocols[Index]; // // Create the event @@ -245,8 +248,10 @@ CoreDisplayMissingArchProtocols ( { CONST GUID_TO_STRING_PROTOCOL_ENTRY *MissingEntry; ARCHITECTURAL_PROTOCOL_ENTRY *Entry; + UINTN Index; - for (Entry = mArchProtocols; Entry->ProtocolGuid != NULL; Entry++) { + for (Index = 0; Index < sizeof (mArchProtocols) / sizeof (mArchProtocols[0]); Index++) { + Entry = &mArchProtocols[Index]; if (!Entry->Present) { for (MissingEntry = MissingProtocols; TRUE ; MissingEntry++) { if (CompareGuid (Entry->ProtocolGuid, MissingEntry->ProtocolGuid)) {