mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-20 02:42:09 +03:00
moved the handling of SFTP handles to new linked list code
Each SFTP file handle is now handled by the "mother-struct" using the generic linked list functions. The goal is to move all custom linked list code to use this set of functions. I also moved the list declarations to the misc.h where they belong and made misc.h no longer include libssh2_priv.h itself since now libssh2_priv.h needs misc.h... In misc.c I added a #if 0'ed _libssh2_list_insert() function because I ended up writing one, and I believe we may need it here too once we move over more stuff to use the _libssh2_list* family.
This commit is contained in:
27
src/misc.c
27
src/misc.c
@@ -426,3 +426,30 @@ void _libssh2_list_remove(struct list_node *entry)
|
||||
else
|
||||
entry->head->last = entry->prev;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* insert a node before the given 'after' entry */
|
||||
void _libssh2_list_insert(struct list_node *after, /* insert before this */
|
||||
struct list_node *entry)
|
||||
{
|
||||
/* 'after' is next to 'entry' */
|
||||
bentry->next = after;
|
||||
|
||||
/* entry's prev is then made to be the prev after current has */
|
||||
entry->prev = after->prev;
|
||||
|
||||
/* the node that is now before 'entry' was previously before 'after'
|
||||
and must be made to point to 'entry' correctly */
|
||||
if(entry->prev)
|
||||
entry->prev->next = entry;
|
||||
|
||||
/* after's prev entry points back to entry */
|
||||
after->prev = entry;
|
||||
|
||||
/* after's next entry is still the same as before */
|
||||
|
||||
/* entry's head is the same as after's */
|
||||
entry->head = after->head;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user