Changeset 744
- Timestamp:
- 05/06/07 19:02:23 (2 years ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/cherokee/avl.c (modified) (3 diffs)
- cherokee/trunk/cherokee/table.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r732 r744 1 2007-05-06 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 3 * cherokee/table.c (cherokee_table_add), 4 cherokee/avl.c (avl_insert_by_key): Return ret_deny if it tries to 5 insert an element that was already on the table. Until now, it was 6 just ignoring the operation while it was returning 7 ret_ok. Obviously it was wrong. This change may have some unwanted 8 side effects, stay tuned. 9 1 10 2007-04-30 A.D.F <adefacc@tin.it> 2 11 cherokee/trunk/cherokee/avl.c
r446 r744 132 132 avl_node *t, *p, *s, *q, *r; 133 133 int a; 134 int cmpa; 134 135 *index = 0; 135 136 … … 138 139 139 140 while (1) { 140 if (ob->compare_fun (ob->compare_arg, key, p->key) < 1) { 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) { 141 147 /* move left */ 142 148 AVL_SET_RANK (p, (AVL_GET_RANK (p) + 1)); … … 146 152 avl_node * q_node = avl_new_avl_node (key, value, p); 147 153 if (!q_node) { 148 return (-1);154 return -1; 149 155 } else { 150 156 q = q_node; cherokee/trunk/cherokee/table.c
r597 r744 143 143 144 144 re = avl_insert_by_key (tab, strdup(key), value, &index); 145 if (unlikely (re != 0)) return ret_error; 145 if (unlikely (re != 0)) { 146 switch (re) { 147 case -2: 148 return ret_deny; 149 default: 150 return ret_error; 151 } 152 } 146 153 147 154 return ret_ok;