mirror of
https://github.com/libssh2/libssh2.git
synced 2025-10-31 23:30:25 +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:
@@ -85,6 +85,7 @@
|
||||
#include "libssh2.h"
|
||||
#include "libssh2_publickey.h"
|
||||
#include "libssh2_sftp.h"
|
||||
#include "misc.h" /* for the linked list stuff */
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
@@ -547,8 +548,9 @@ struct _LIBSSH2_PUBLICKEY
|
||||
|
||||
struct _LIBSSH2_SFTP_HANDLE
|
||||
{
|
||||
struct list_node node;
|
||||
|
||||
LIBSSH2_SFTP *sftp;
|
||||
LIBSSH2_SFTP_HANDLE *prev, *next;
|
||||
|
||||
/* This is a pre-allocated buffer used for sending SFTP requests as the
|
||||
whole thing might not get sent in one go. This buffer is used for read,
|
||||
@@ -588,7 +590,8 @@ struct _LIBSSH2_SFTP
|
||||
|
||||
LIBSSH2_PACKET_BRIGADE packets;
|
||||
|
||||
LIBSSH2_SFTP_HANDLE *handles;
|
||||
/* a list of _LIBSSH2_SFTP_HANDLE structs */
|
||||
struct list_head sftp_handles;
|
||||
|
||||
unsigned long last_errno;
|
||||
|
||||
@@ -928,22 +931,6 @@ struct _LIBSSH2_SESSION
|
||||
#define LIBSSH2_SOCKET_RECV_FLAGS(session) 0
|
||||
#endif
|
||||
|
||||
/* -------- */
|
||||
|
||||
/* First take towards a generic linked list handling code for libssh2
|
||||
internals */
|
||||
|
||||
struct list_head {
|
||||
struct list_node *last;
|
||||
struct list_node *first;
|
||||
};
|
||||
|
||||
struct list_node {
|
||||
struct list_node *next;
|
||||
struct list_node *prev;
|
||||
struct list_head *head;
|
||||
};
|
||||
|
||||
/* --------- */
|
||||
|
||||
/* libssh2 extensible ssh api, ultimately I'd like to allow loading additional
|
||||
|
||||
Reference in New Issue
Block a user