new mavl is working now

FossilOrigin-Name: 65a4eefffea57509c0d7fd573e53b15bf4a730ce297b7db182aaac796ea92448
This commit is contained in:
7u83@mail.ru
2018-03-10 23:56:41 +00:00
parent e4d65ef470
commit 4171d208d0
79 changed files with 1296 additions and 1112 deletions

View File

@ -1,15 +1,38 @@
#include "mavl.h"
union mavldata *mavl_replace(struct mavl *t,void *data){
void *mavl_replace(struct mavl *t,const void *data, int * replaced){
int exists;
void * add = mavl_add(t,data,&exists);
if (replaced != NULL){
*replaced = exists;
}
if (!exists){
return add;
}
if(t->del){
t->del(add);
}
memcpy(add,data,t->data_size);
return add;
/*
struct mavlnode * node = mavl_get_node(t,data);
if (node){
if (t->del)
t->del(node+sizeof(struct mavlnode));
/* node->data=*data;
*/ mavlnode_copy_data(node+sizeof(struct mavlnode), data);
return &node->data;
// node->data=*data;
memcpy(mavlnode_dataptr(node), data, t->data_size);
// return &node->data;
return mavlnode_dataptr(node);
}
return mavl_add(t,data);
*/
}