NIM: BUG: LIB: optimize khui_find_action()
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 27 Sep 2007 03:44:29 +0000 (03:44 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 27 Sep 2007 03:44:29 +0000 (03:44 +0000)
In Network Identity Manager, when locating the action object
corresponding to an action identifier using khui_find_action(), don't
search through the list of standard actions if we already know that
the object we are searching for is a custom action.

ticket: new
component: windows

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19984 dc483132-0cff-0310-8789-dd5450dbe970

src/windows/identity/uilib/action.c

index a47683171bbe04132d2e141245438def0d13604d..04fb52a8493911cef11873eca1568507bd8812b8 100644 (file)
@@ -796,16 +796,18 @@ khui_find_menu(khm_int32 id) {
 
 KHMEXP khui_action * KHMAPI
 khui_find_action(khm_int32 id) {
-    khui_action * act;
+    khui_action * act = NULL;
     int i;
 
-    act = khui_actions;
-    for(i=0;i<khui_n_actions;i++) {
-        if(act[i].cmd == id)
-            return &act[i];
-    }
+    if (id < KHUI_USERACTION_BASE) {
+        act = khui_actions;
+        for(i=0;i<khui_n_actions;i++) {
+            if(act[i].cmd == id)
+                return &act[i];
+        }
 
-    act = NULL;
+        return NULL;
+    }
 
     EnterCriticalSection(&cs_actions);
     if (id >= KHUI_USERACTION_BASE &&