Changeset 836
- Timestamp:
- 07/17/07 18:08:48 (1 year ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/cherokee/avl.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r835 r836 1 1 2007-07-17 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 3 * cherokee/avl.c (cherokee_avl_mrproper): Implemented. 2 4 3 5 * qa/run-tests.py: Count down fixed. cherokee/trunk/cherokee/avl.c
r835 r836 43 43 44 44 45 static cherokee_avl_node_t *node_first (cherokee_avl_t *avl); 46 static cherokee_avl_node_t *node_prev (cherokee_avl_node_t *node); 47 static cherokee_avl_node_t *node_next (cherokee_avl_node_t *node); 48 49 45 50 /* Nodes 46 51 */ … … 84 89 85 90 86 static ret_t87 mrproper2_while (cherokee_buffer_t *key, void *value, void *param)88 {89 cherokee_avl_value_free_func_t free_func = param;90 91 if (free_func) {92 free_func(value);93 }94 95 return ret_ok;96 }97 98 91 ret_t 99 92 cherokee_avl_mrproper (cherokee_avl_t *avl, cherokee_avl_value_free_func_t free_func) 100 93 { 101 /* Free all the entries 102 */ 103 cherokee_avl_while (avl, mrproper2_while, free_func, NULL, NULL); 104 105 /* Clean the entries as well 106 */ 107 // TODO ! 94 cherokee_avl_node_t *node; 95 cherokee_avl_node_t *next; 96 97 node = node_first (avl); 98 99 while (node) { 100 next = node_next (node); 101 102 cherokee_buffer_mrproper (&node->id); 103 if (free_func) 104 free_func (node->value); 105 106 free (node); 107 node = next; 108 } 108 109 109 110 return ret_ok; … … 150 151 151 152 static cherokee_avl_node_t * 153 node_first (cherokee_avl_t *avl) 154 { 155 cherokee_avl_node_t *tmp; 156 157 if (!avl->root) 158 return NULL; 159 160 tmp = avl->root; 161 162 while (tmp->left_child) 163 tmp = tmp->left; 164 165 return tmp; 166 } 167 168 static cherokee_avl_node_t * 169 node_next (cherokee_avl_node_t *node) 170 { 171 cherokee_avl_node_t *tmp = node->right; 172 173 if (node->right_child) 174 while (tmp->left_child) 175 tmp = tmp->left; 176 return tmp; 177 } 178 179 static cherokee_avl_node_t * 152 180 node_prev (cherokee_avl_node_t *node) 153 181 { … … 160 188 } 161 189 162 static cherokee_avl_node_t *163 node_first (cherokee_avl_t *avl)164 {165 cherokee_avl_node_t *tmp;166 167 if (!avl->root)168 return NULL;169 170 tmp = avl->root;171 172 while (tmp->left_child)173 tmp = tmp->left;174 175 return tmp;176 }177 178 static cherokee_avl_node_t *179 node_next (cherokee_avl_node_t *node)180 {181 cherokee_avl_node_t *tmp = node->right;182 183 if (node->right_child)184 while (tmp->left_child)185 tmp = tmp->left;186 return tmp;187 }188 190 189 191 static cherokee_avl_node_t *