avltree_replace_data inline function added.
FossilOrigin-Name: 77c780968f4583c4409288378d61dc69b3072861dfb40cbf43f1f0faf941a580
This commit is contained in:
parent
8929502836
commit
cbf674f1cb
@ -23,6 +23,7 @@
|
||||
#ifndef __AVLTREE_H
|
||||
#define __AVLTREE_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct avlnode{
|
||||
@ -63,10 +64,17 @@ static inline void * avltree_get(struct avltree *t ,void *data){
|
||||
if (!n)
|
||||
return NULL;
|
||||
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_insert(t,d) avltree_add(t,d)
|
||||
//#define avltree_walk(t,dir) avltree_foreach(t,dir)
|
||||
|
Loading…
Reference in New Issue
Block a user