uses mavl now

FossilOrigin-Name: 2b3ecb32b8512b81e2a973950c57a26e86bfa85e1d15d1af5c30ffade595a82f
This commit is contained in:
7u83@mail.ru 2016-04-09 16:07:30 +00:00
parent 5464d95224
commit adc6489d9b
1 changed files with 23 additions and 6 deletions

View File

@ -1,3 +1,20 @@
/*
This file is part of actube.
actube is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libcapwap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <errno.h>
@ -32,7 +49,7 @@ struct connlist * connlist_create(int len)
return 0;
cl->t = avltree_create(connlist_cmp,0);
cl->t = mavl_create(connlist_cmp,0);
if (!cl->t){
free(cl);
@ -40,7 +57,7 @@ struct connlist * connlist_create(int len)
}
if (pthread_mutex_init(&cl->connlist_mutex,NULL)){
avltree_destroy(cl->t);
mavl_destroy(cl->t);
free(cl);
return 0;
};
@ -67,7 +84,7 @@ void connlist_destroy(struct connlist * cl)
return;
if (cl->t)
avltree_destroy(cl->t);
mavl_destroy(cl->t);
pthread_mutex_destroy(&cl->connlist_mutex);
free(cl);
@ -78,7 +95,7 @@ struct conn * connlist_get(struct connlist * cl, const struct sockaddr * addr)
{
struct conn dummy;
sock_copyaddr(&dummy.addr,addr);
return avltree_get(cl->t,&dummy);
return mavl_get(cl->t,&dummy);
}
@ -88,13 +105,13 @@ struct conn * connlist_add(struct connlist * cl, struct conn * conn)
if (cl->t->count>=cl->len)
return 0;
return avltree_add(cl->t,conn);
return mavl_add(cl->t,conn);
}
void connlist_remove(struct connlist *cl,struct conn * conn)
{
avltree_del(cl->t,conn);
mavl_del(cl->t,conn);
}