mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-07 10:40:28 +09:00
channels: replaced bugged lists with ssh_list
(cherry picked from commit 6d8bb956c5)
Conflicts:
src/channels.c
src/session.c
This commit is contained in:
committed by
Andreas Schneider
parent
6f650a61ca
commit
64b125700e
12
src/misc.c
12
src/misc.c
@@ -377,6 +377,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;
|
||||
@@ -387,9 +389,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