mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
renamed ssh_list_get_head to ssh_list_pop_head
This commit is contained in:
@@ -49,11 +49,7 @@ struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list);
|
|||||||
int ssh_list_add(struct ssh_list *list, const void *data);
|
int ssh_list_add(struct ssh_list *list, const void *data);
|
||||||
void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator);
|
void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator);
|
||||||
|
|
||||||
/** @brief fetch the head element of a list and remove it from list
|
const void *_ssh_list_pop_head(struct ssh_list *list);
|
||||||
* @param list the ssh_list to use
|
|
||||||
* @return the first element of the list
|
|
||||||
*/
|
|
||||||
const void *_ssh_list_get_head(struct ssh_list *list);
|
|
||||||
|
|
||||||
#define ssh_iterator_value(type, iterator)\
|
#define ssh_iterator_value(type, iterator)\
|
||||||
((type)((iterator)->data))
|
((type)((iterator)->data))
|
||||||
@@ -61,9 +57,9 @@ const void *_ssh_list_get_head(struct ssh_list *list);
|
|||||||
/** @brief fetch the head element of a list and remove it from list
|
/** @brief fetch the head element of a list and remove it from list
|
||||||
* @param type type of the element to return
|
* @param type type of the element to return
|
||||||
* @param list the ssh_list to use
|
* @param list the ssh_list to use
|
||||||
* @return the first element of the list
|
* @return the first element of the list, or NULL if the list is empty
|
||||||
*/
|
*/
|
||||||
#define ssh_list_get_head(type, ssh_list)\
|
#define ssh_list_pop_head(type, ssh_list)\
|
||||||
((type)_ssh_list_get_head(ssh_list))
|
((type)_ssh_list_pop_head(ssh_list))
|
||||||
|
|
||||||
#endif /* MISC_H_ */
|
#endif /* MISC_H_ */
|
||||||
|
|||||||
@@ -710,7 +710,7 @@ ssh_message ssh_message_get(ssh_session session) {
|
|||||||
leave_function();
|
leave_function();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
msg=ssh_list_get_head(ssh_message, session->ssh_message_list);
|
msg=ssh_list_pop_head(ssh_message, session->ssh_message_list);
|
||||||
} while(msg==NULL);
|
} while(msg==NULL);
|
||||||
msg=ssh_message_pop_head(session);
|
msg=ssh_message_pop_head(session);
|
||||||
leave_function();
|
leave_function();
|
||||||
|
|||||||
@@ -261,7 +261,14 @@ void ssh_list_remove(struct ssh_list *list, struct ssh_iterator *iterator){
|
|||||||
SAFE_FREE(iterator);
|
SAFE_FREE(iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *_ssh_list_get_head(struct ssh_list *list){
|
/** @internal
|
||||||
|
* @brief Removes the top element of the list and returns the data value attached
|
||||||
|
* to it
|
||||||
|
* @param list the ssh_list
|
||||||
|
* @returns pointer to the element being stored in head, or
|
||||||
|
* NULL if the list is empty.
|
||||||
|
*/
|
||||||
|
const void *_ssh_list_pop_head(struct ssh_list *list){
|
||||||
struct ssh_iterator *iterator=list->root;
|
struct ssh_iterator *iterator=list->root;
|
||||||
const void *data;
|
const void *data;
|
||||||
if(!list->root)
|
if(!list->root)
|
||||||
|
|||||||
@@ -912,7 +912,7 @@ int ssh_execute_message_callbacks(ssh_session session){
|
|||||||
if(!session->ssh_message_list)
|
if(!session->ssh_message_list)
|
||||||
return SSH_OK;
|
return SSH_OK;
|
||||||
if(session->ssh_message_callback){
|
if(session->ssh_message_callback){
|
||||||
while(ssh_list_get_head(ssh_message , session->ssh_message_list) != NULL){
|
while(ssh_list_pop_head(ssh_message , session->ssh_message_list) != NULL){
|
||||||
msg=ssh_message_pop_head(session);
|
msg=ssh_message_pop_head(session);
|
||||||
ret=session->ssh_message_callback(session,msg);
|
ret=session->ssh_message_callback(session,msg);
|
||||||
if(ret==1){
|
if(ret==1){
|
||||||
@@ -925,7 +925,7 @@ int ssh_execute_message_callbacks(ssh_session session){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(ssh_list_get_head(ssh_message , session->ssh_message_list) != NULL){
|
while(ssh_list_pop_head(ssh_message , session->ssh_message_list) != NULL){
|
||||||
msg=ssh_message_pop_head(session);
|
msg=ssh_message_pop_head(session);
|
||||||
ret = ssh_message_reply_default(msg);
|
ret = ssh_message_reply_default(msg);
|
||||||
ssh_message_free(msg);
|
ssh_message_free(msg);
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ void ssh_free(ssh_session session) {
|
|||||||
privatekey_free(session->rsa_key);
|
privatekey_free(session->rsa_key);
|
||||||
if(session->ssh_message_list){
|
if(session->ssh_message_list){
|
||||||
ssh_message msg;
|
ssh_message msg;
|
||||||
while((msg=ssh_list_get_head(ssh_message ,session->ssh_message_list))
|
while((msg=ssh_list_pop_head(ssh_message ,session->ssh_message_list))
|
||||||
!= NULL){
|
!= NULL){
|
||||||
ssh_message_free(msg);
|
ssh_message_free(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user