Changeset 745

Show
Ignore:
Timestamp:
05/06/07 19:13:12 (2 years ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r744 r745  
    112007-05-06  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/avl.c (avl_insert_by_key): Micro-optimization: Move the 
     4        less probable case to the last position. 
    25 
    36        * cherokee/table.c (cherokee_table_add), 
  • cherokee/trunk/cherokee/avl.c

    r744 r745  
    140140                while (1) { 
    141141                        cmpa = ob->compare_fun (ob->compare_arg, key, p->key); 
    142                         if (cmpa == 0) { 
    143                                 /* The element is already in the tree 
    144                                  */ 
    145                                 return -2; 
    146                         } else if (cmpa < 1) { 
     142 
     143                        if (cmpa < 0) { 
    147144                                /* move left */ 
    148145                                AVL_SET_RANK (p, (AVL_GET_RANK (p) + 1)); 
     
    163160                                } 
    164161                                p = q; 
    165                         } else
     162                        } else if (cmpa > 0)
    166163                                /* move right */ 
    167164                                q = p->right; 
     
    182179                                } 
    183180                                p = q; 
     181                        } else { 
     182                                /* The element is already in the tree 
     183                                 */ 
     184                                return -2; 
    184185                        } 
    185186                }