1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

channels: replaced bugged lists with ssh_list

cherry-picked from 0aef5f
Conflicts:

	src/session.c
This commit is contained in:
Aris Adamantiadis
2011-09-02 13:46:10 +03:00
parent 3eece8ac0b
commit 6d8bb956c5
7 changed files with 42 additions and 41 deletions

View File

@@ -373,6 +373,8 @@ struct ssh_list *ssh_list_new(){
void ssh_list_free(struct ssh_list *list){
struct ssh_iterator *ptr,*next;
if(!list)
return;
ptr=list->root;
while(ptr){
next=ptr->next;
@@ -383,9 +385,19 @@ void ssh_list_free(struct ssh_list *list){
}
struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list){
if(!list)
return NULL;
return list->root;
}
struct ssh_iterator *ssh_list_find(const struct ssh_list *list, void *value){
struct ssh_iterator *it;
for(it = ssh_list_get_iterator(list); it != NULL ;it=it->next)
if(it->data==value)
return it;
return NULL;
}
static struct ssh_iterator *ssh_iterator_new(const void *data){
struct ssh_iterator *iterator=malloc(sizeof(struct ssh_iterator));
if(!iterator)