avltree_replace_data inline function added.

FossilOrigin-Name: 77c780968f4583c4409288378d61dc69b3072861dfb40cbf43f1f0faf941a580
This commit is contained in:
7u83@mail.ru 2015-04-05 01:31:50 +00:00
parent 8929502836
commit cbf674f1cb

View File

@ -23,6 +23,7 @@
#ifndef __AVLTREE_H #ifndef __AVLTREE_H
#define __AVLTREE_H #define __AVLTREE_H
#include <string.h>
#include <stdio.h> #include <stdio.h>
struct avlnode{ struct avlnode{
@ -63,8 +64,15 @@ static inline void * avltree_get(struct avltree *t ,void *data){
if (!n) if (!n)
return NULL; return NULL;
return n->data; return n->data;
}
static inline void * avltree_replace_data(struct avltree *t ,void *data,int len) {
void * df = avltree_get(t,data);
if(!df)
return NULL;
memcpy(df,data,len);
return df;
} }
#define avltree_find(t,d) avltree_get(t,d) #define avltree_find(t,d) avltree_get(t,d)