[WIN32K]
authorJérôme Gardou <jerome.gardou@reactos.org>
Thu, 7 Aug 2014 10:59:54 +0000 (10:59 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Thu, 7 Aug 2014 10:59:54 +0000 (10:59 +0000)
 - Among a thousand ways to loop over a list, choose the simple one.

svn path=/trunk/; revision=63829

reactos/win32ss/user/ntuser/menu.c

index 61f7d45..0f8c59f 100644 (file)
@@ -1143,7 +1143,6 @@ BOOL FASTCALL
 IntCleanupMenus(struct _EPROCESS *Process, PPROCESSINFO Win32Process)
 {
    PEPROCESS CurrentProcess;
-   PLIST_ENTRY LastHead = NULL;
    PMENU MenuObject;
 
    CurrentProcess = PsGetCurrentProcess();
@@ -1152,10 +1151,8 @@ IntCleanupMenus(struct _EPROCESS *Process, PPROCESSINFO Win32Process)
       KeAttachProcess(&Process->Pcb);
    }
 
-   while (Win32Process->MenuListHead.Flink != &(Win32Process->MenuListHead) &&
-          Win32Process->MenuListHead.Flink != LastHead)
+   while (!IsEmptyList(&Win32Process->MenuListHead))
    {
-      LastHead = Win32Process->MenuListHead.Flink;
       MenuObject = CONTAINING_RECORD(Win32Process->MenuListHead.Flink, MENU, ListEntry);
       TRACE("Menus are stuck on the process list!\n");
       IntDestroyMenuObject(MenuObject, FALSE, TRUE);