aboutsummaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2011-09-02 13:46:10 +0300
committerAris Adamantiadis <aris@0xbadc0de.be>2011-09-02 13:46:10 +0300
commit6d8bb956c5caa48c2aba6713f067224650c3c1e1 (patch)
tree00ab42ac7c63dc6e030f844f93cfb58999477bb2 /src/misc.c
parent3eece8ac0b107a7df8d95325ef17ed19d6429e75 (diff)
downloadlibssh-6d8bb956c5caa48c2aba6713f067224650c3c1e1.tar.gz
libssh-6d8bb956c5caa48c2aba6713f067224650c3c1e1.tar.xz
libssh-6d8bb956c5caa48c2aba6713f067224650c3c1e1.zip
channels: replaced bugged lists with ssh_list
cherry-picked from 0aef5f Conflicts: src/session.c
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/misc.c b/src/misc.c
index c1e6ef2d..7dadb230 100644
--- a/src/misc.c
+++ b/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)