Changeset 745
- Timestamp:
- 05/06/07 19:13:12 (2 years ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/cherokee/avl.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r744 r745 1 1 2007-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. 2 5 3 6 * cherokee/table.c (cherokee_table_add), cherokee/trunk/cherokee/avl.c
r744 r745 140 140 while (1) { 141 141 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) { 147 144 /* move left */ 148 145 AVL_SET_RANK (p, (AVL_GET_RANK (p) + 1)); … … 163 160 } 164 161 p = q; 165 } else {162 } else if (cmpa > 0) { 166 163 /* move right */ 167 164 q = p->right; … … 182 179 } 183 180 p = q; 181 } else { 182 /* The element is already in the tree 183 */ 184 return -2; 184 185 } 185 186 }