renamed capwap directory to cw.
FossilOrigin-Name: 8a43dd9d05a4cb73210243ddd8df2a26f16c7ef2c4d4e36ab446de1f65d88223
This commit is contained in:
35
src/cw/intavltree.c
Normal file
35
src/cw/intavltree.c
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "intavltree.h"
|
||||
|
||||
|
||||
static int cmp(const void *v1,const void*v2)
|
||||
{
|
||||
return *((int*)v1) - *((int*)v2);
|
||||
}
|
||||
|
||||
static void del(void* d)
|
||||
{
|
||||
free (d);
|
||||
return;
|
||||
}
|
||||
|
||||
struct mavl * intavltree_create()
|
||||
{
|
||||
return mavl_create(cmp,del);
|
||||
}
|
||||
|
||||
int * intavltree_add(struct mavl * t, int val)
|
||||
{
|
||||
int *v = mavl_get(t,&val);
|
||||
if (v)
|
||||
return v;
|
||||
|
||||
v = malloc(sizeof(int));
|
||||
if (!v)
|
||||
return NULL;
|
||||
*v=val;
|
||||
return mavl_add(t,v);
|
||||
}
|
Reference in New Issue
Block a user