mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
Improve request_queue_(new,free).
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@581 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -480,22 +480,27 @@ int sftp_init(SFTP_SESSION *sftp) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static REQUEST_QUEUE *request_queue_new(SFTP_MESSAGE *msg){
|
static REQUEST_QUEUE *request_queue_new(SFTP_MESSAGE *msg) {
|
||||||
REQUEST_QUEUE *queue;
|
REQUEST_QUEUE *queue = NULL;
|
||||||
|
|
||||||
queue = malloc(sizeof(REQUEST_QUEUE));
|
queue = malloc(sizeof(REQUEST_QUEUE));
|
||||||
if (queue == NULL) {
|
if (queue == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
ZERO_STRUCTP(queue);
|
||||||
|
|
||||||
memset(queue,0,sizeof(REQUEST_QUEUE));
|
queue->message = msg;
|
||||||
queue->message=msg;
|
|
||||||
return queue;
|
return queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_queue_free(REQUEST_QUEUE *queue){
|
static void request_queue_free(REQUEST_QUEUE *queue) {
|
||||||
memset(queue,0,sizeof(*queue));
|
if (queue == NULL) {
|
||||||
free(queue);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZERO_STRUCTP(queue);
|
||||||
|
SAFE_FREE(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sftp_enqueue(SFTP_SESSION *sftp, SFTP_MESSAGE *msg){
|
void sftp_enqueue(SFTP_SESSION *sftp, SFTP_MESSAGE *msg){
|
||||||
|
|||||||
Reference in New Issue
Block a user