2014-07-11 22:12:11 +02:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "stravltree.h"
|
|
|
|
|
|
|
|
|
|
|
|
static int cmp(const void *v1,const void*v2)
|
|
|
|
{
|
|
|
|
return strcmp( (char*)v1,(char*)v2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void del(void* d)
|
|
|
|
{
|
|
|
|
free (d);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct avltree * stravltree_create()
|
|
|
|
{
|
2018-03-06 18:28:31 +01:00
|
|
|
return mavl_create(cmp,del);
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const char * stravltree_add(struct avltree * t, const char * str)
|
|
|
|
{
|
|
|
|
char * s = strdup(str);
|
|
|
|
if (!s)
|
|
|
|
return 0;
|
2018-03-06 18:28:31 +01:00
|
|
|
return mavl_add(t,s);
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|