queue.c
/*
 * Attempt to remove element from tail of queue.
 * Other attribute is as same as q_remove_head.
 */
Attempt to remove element from tail of queue.
Other attribute is as same as q_remove_head.
Attempt to remove element from tail of queue . Other attribute is as same as q_remove_head .
element_t *q_remove_tail(struct list_head *head, char *sp, size_t bufsize)
{
    if (!head || head->next == head)
        return NULL;
    else {
        struct list_head *del = head->prev;
        list_del_init(head->prev);
        element_t *del_ele = list_entry(del, element_t, list);
        if (sp) {
            strncpy(sp, del_ele->value, bufsize - 1);
            *(sp + bufsize - 1) = '\0';
        }
        return del_ele;
    }
}
element_t * q_remove_tail ( struct list_head * head , char * sp , size_t bufsize ) { if ( ! head || head -> next == head ) return NULL ; else { struct list_head * del = head -> prev ; list_del_init ( head -> prev ) ; element_t * del_ele = list_entry ( del , element_t , list ) ; if ( sp ) { strncpy ( sp , del_ele -> value , bufsize - 1 ) ; * ( sp + bufsize - 1 ) = ' \0 ' ; } return del_ele ; } }
Attempt to remove element from tail of queue.
Attempt to remove element from tail of queue .