pull up r19984 from trunk
authorTom Yu <tlyu@mit.edu>
Mon, 1 Oct 2007 23:14:58 +0000 (23:14 +0000)
committerTom Yu <tlyu@mit.edu>
Mon, 1 Oct 2007 23:14:58 +0000 (23:14 +0000)
 r19984@cathode-dark-space:  jaltman | 2007-09-26 23:44:29 -0400
 ticket: new
 subject: NIM: BUG: LIB: optimize khui_find_action()
 component: windows

 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: 5779
version_fixed: 1.6.3

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@20054 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 &&