avl_ptr delete_node(val_ptr father,val_ptr p){ if(father->right==p){ father->right=p->right; if(p->left!=NULL){ re_new(p->left); } }else{ father->left=p->left; if(p->right!=NULL){ re_new(p->right); } } free(p); }
void *dict_recurse_new(t_symbol *sym, long argc, t_atom *argv) { t_dict_recurse *x = NULL; x = (t_dict_recurse *)object_alloc(dict_recurse_class); if (x == NULL) { MY_ERR("Object allocation failed."); return NULL; } x->outl_bang = bangout(x); // Outler 1: Bang on completion x->outl_mess = outlet_new((t_object*)x, NULL); // Outlet 0: General messages x->path_len_max = MAX_LEN_PATH; x->path = NULL; x->path = (char *)sysmem_newptr(sizeof(char) * x->path_len_max); if (!x->path) { MY_ERR("new: Allocation error for \"path\"."); } x->search_key_expr = regexpr_new(); x->search_val_expr = regexpr_new(); if (!x->search_key_expr || !x->search_val_expr) { MY_ERR("new: Allocation error for the search expressions."); } _dict_recurse_reset(x); re_set_object(x); x->re2 = re_new(254); if (!x->re2) { return NULL; } return(x); }
void re_new(val_ptr p,val_ptr father,SEARCH_TREE root) { if(p->left!=NULL) re_new(p->left,p,root); if(p->right!=NULL) re_new(p->right,p,root); element_type i=p->element; if(father->left==p) father->left=NULL; else father->right=NULL; free(p); root=insert(i,root); }