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:
12
src/misc.c
12
src/misc.c
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user